Commit:     5131a184a3458d9ac47d9eba032cf4c4d3295afd
Parent:     186e234358ba29a4094d0c8c0d3ea00f84d32a3e
Author:     Zach Brown <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 22 15:14:46 2007 -0700
Committer:  Vlad Yasevich <[EMAIL PROTECTED]>
CommitDate: Tue Jun 26 09:29:09 2007 -0400

    SCTP: lock_sock_nested in sctp_sock_migrate
    sctp_sock_migrate() grabs the socket lock on a newly allocated socket while
    holding the socket lock on an old socket.  lockdep worries that this might
    be a recursive lock attempt.
     task/3026 is trying to acquire lock:
      (sk_lock-AF_INET){--..}, at: [<ffffffff88105b8c>] 
sctp_sock_migrate+0x2e3/0x327 [sctp]
     but task is already holding lock:
      (sk_lock-AF_INET){--..}, at: [<ffffffff8810891f>] sctp_accept+0xdf/0x1e3 
    This patch tells lockdep that this locking is safe by using
    Signed-off-by: Zach Brown <[EMAIL PROTECTED]>
    Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]>
 net/sctp/socket.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 2fc0366..67861a8 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()
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to