]> 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)
commit09ab5da1278afb88f739debbd89d94ae6b021675
tree1785c927d5e19320706b5fa78effe0fc9f271c71
parent620c9ba7346e3a7f887c9b02f3523bc50ecc6fe9
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: 61c7c10bd6bf ("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