aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2012-12-03 03:12:07 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-12-07 17:23:23 -0500
commit258f8667a29d72b1c220065632b39c0faeb061ca (patch)
treea01ac092de6ade5a15cb9202696c635403e0e8ea /net/tipc/socket.c
parentcbab368790f23bc917d97fcf7a338c5ba5336ee0 (diff)
tipc: add lock nesting notation to quiet lockdep warning
TIPC accept() call grabs the socket lock on a newly allocated socket while holding the socket lock on an old socket. But lockdep worries that this might be a recursive lock attempt: [ INFO: possible recursive locking detected ] --------------------------------------------- kworker/u:0/6 is trying to acquire lock: (sk_lock-AF_TIPC){+.+.+.}, at: [<c8c1226c>] accept+0x15c/0x310 [tipc] but task is already holding lock: (sk_lock-AF_TIPC){+.+.+.}, at: [<c8c12138>] accept+0x28/0x310 [tipc] other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(sk_lock-AF_TIPC); lock(sk_lock-AF_TIPC); *** DEADLOCK *** May be due to missing lock nesting notation [...] Tell lockdep that this locking is safe by using lock_sock_nested(). This is similar to what was done in commit 5131a184a3458d9 for SCTP code ("SCTP: lock_sock_nested in sctp_sock_migrate"). Also note that this is isn't something that is seen normally, as it was uncovered with some experimental work-in-progress code not yet ready for mainline. So no need for stable backports or similar of this commit. Signed-off-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index ef75b6270247..b5c9795cf151 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1543,7 +1543,8 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags)
1543 u32 new_ref = new_tport->ref; 1543 u32 new_ref = new_tport->ref;
1544 struct tipc_msg *msg = buf_msg(buf); 1544 struct tipc_msg *msg = buf_msg(buf);
1545 1545
1546 lock_sock(new_sk); 1546 /* we lock on new_sk; but lockdep sees the lock on sk */
1547 lock_sock_nested(new_sk, SINGLE_DEPTH_NESTING);
1547 1548
1548 /* 1549 /*
1549 * Reject any stray messages received by new socket 1550 * Reject any stray messages received by new socket