diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 2fc036699d4833a964396ab65e432a214d9d02dc..67861a8f00cb3ecd814affc27a73902b140250db 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -6123,8 +6123,11 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, * queued to the backlog. This prevents a potential race between * backlog processing on the old socket and new-packet processing * on the new socket. + * + * The caller has just allocated newsk so we can guarantee that other + * paths won't try to lock it and then oldsk. */ - sctp_lock_sock(newsk); + lock_sock_nested(newsk, SINGLE_DEPTH_NESTING); sctp_assoc_migrate(assoc, newsk); /* If the association on the newsk is already closed before accept()