]> git.baikalelectronics.ru Git - kernel.git/commit
SUNRPC: Do not dereference non-socket transports in sysfs
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 25 Mar 2022 14:37:31 +0000 (10:37 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 25 Mar 2022 17:22:58 +0000 (13:22 -0400)
commit6b12009f35262860cff8649190365f271fea3d0a
tree1785c927d5e19320706b5fa78effe0fc9f271c71
parent36325a0e1a8b6dc5a06bc628b185e0a48b036b67
SUNRPC: Do not dereference non-socket transports in sysfs

Do not cast the struct xprt to a sock_xprt unless we know it is a UDP or
TCP transport. Otherwise the call to lock the mutex will scribble over
whatever structure is actually there. This has been seen to cause hard
system lockups when the underlying transport was RDMA.

Fixes: 6d351cc7fd17 ("SUNRPC: lock against ->sock changing during sysfs read")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
include/linux/sunrpc/xprt.h
include/linux/sunrpc/xprtsock.h
net/sunrpc/sysfs.c
net/sunrpc/xprtsock.c