aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/socket.c
diff options
context:
space:
mode:
authorZach Brown <zach.brown@oracle.com>2007-06-22 18:14:46 -0400
committerVlad Yasevich <vladislav.yasevich@hp.com>2007-06-26 09:29:09 -0400
commit5131a184a3458d9ac47d9eba032cf4c4d3295afd (patch)
tree1f216caeef9c70ff5bc76fd08fa7f5a0ae2cbe99 /net/sctp/socket.c
parent186e234358ba29a4094d0c8c0d3ea00f84d32a3e (diff)
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 [sctp] This patch tells lockdep that this locking is safe by using lock_sock_nested(). Signed-off-by: Zach Brown <zach.brown@oracle.com> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r--net/sctp/socket.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 2fc036699d48..67861a8f00cb 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,
6123 * queued to the backlog. This prevents a potential race between 6123 * queued to the backlog. This prevents a potential race between
6124 * backlog processing on the old socket and new-packet processing 6124 * backlog processing on the old socket and new-packet processing
6125 * on the new socket. 6125 * on the new socket.
6126 *
6127 * The caller has just allocated newsk so we can guarantee that other
6128 * paths won't try to lock it and then oldsk.
6126 */ 6129 */
6127 sctp_lock_sock(newsk); 6130 lock_sock_nested(newsk, SINGLE_DEPTH_NESTING);
6128 sctp_assoc_migrate(assoc, newsk); 6131 sctp_assoc_migrate(assoc, newsk);
6129 6132
6130 /* If the association on the newsk is already closed before accept() 6133 /* If the association on the newsk is already closed before accept()