]> git.baikalelectronics.ru Git - kernel.git/commit
af_unix: move unix_mknod() out of bindlock
authorWANG Cong <xiyou.wangcong@gmail.com>
Mon, 23 Jan 2017 19:17:35 +0000 (11:17 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Jan 2017 19:30:56 +0000 (14:30 -0500)
commita27a55a9da22e755eee36c70e493b216299153c5
tree4fe2e2d2f415b7b831e8c3ee999a1915a24d2d4e
parent457e59526c3a132edd642988d1cfed2d1fa824a0
af_unix: move unix_mknod() out of bindlock

Dmitry reported a deadlock scenario:

unix_bind() path:
u->bindlock ==> sb_writer

do_splice() path:
sb_writer ==> pipe->mutex ==> u->bindlock

In the unix_bind() code path, unix_mknod() does not have to
be done with u->bindlock held, since it is a pure fs operation,
so we can just move unix_mknod() out.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/unix/af_unix.c