]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 11:57:17 +0000 (13:57 +0200)
commit321276722a9e0c9d4323bc003fd32f9f44d7f87c
tree0c2df401a958e19d6dba967dacb4d1673c52636b
parent9e6b8040961e12dec16976e0b1ecfc4738de77a3
SUNRPC: Do not dereference non-socket transports in sysfs

commit 421ab1be43bd015ffe744f4ea25df4f19d1ce6fe upstream.

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: b49ea673e119 ("SUNRPC: lock against ->sock changing during sysfs read")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/sunrpc/xprt.h
include/linux/sunrpc/xprtsock.h
net/sunrpc/sysfs.c
net/sunrpc/xprtsock.c