* [PATCH 5.10.y] SUNRPC: lock against ->sock changing during sysfs read
@ 2026-09-24 16:06 Miguel Gazquez (Schneider Electric)
2026-09-25 18:47 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Miguel Gazquez (Schneider Electric) @ 2026-09-24 16:06 UTC (permalink / raw)
To: stable, Trond Myklebust, Anna Schumaker, J. Bruce Fields,
Chuck Lever, David S. Miller, Jakub Kicinski, Olga Kornievskaia
Cc: Benjamin Robin, Anna Schumaker, linux-nfs, netdev, linux-kernel,
Thomas Petazzoni, NeilBrown, Robert Garcia, Greg Kroah-Hartman,
Miguel Gazquez (Schneider Electric)
From: NeilBrown <neilb@suse.de>
[ Upstream commit b49ea673e119f59c71645e2f65b3ccad857c90ee ]
->sock can be set to NULL asynchronously unless ->recv_mutex is held.
So it is important to hold that mutex. Otherwise a sysfs read can
trigger an oops.
Commit 17f09d3f619a ("SUNRPC: Check if the xprt is connected before
handling sysfs reads") appears to attempt to fix this problem, but it
only narrows the race window.
[ Removed the changes about net/sunrpc/sysfs.c, as this file doesn't
exist in 5.10 ]
Fixes: 17f09d3f619a ("SUNRPC: Check if the xprt is connected before handling sysfs reads")
Fixes: a8482488a7d6 ("SUNRPC query transport's source port")
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Robert Garcia <rob_garcia@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Miguel Gazquez (Schneider Electric) <miguel.gazquez@bootlin.com>
---
net/sunrpc/xprtsock.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 5dccad3271fe..4ec6516a53e0 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1666,7 +1666,12 @@ static int xs_get_srcport(struct sock_xprt *transport)
unsigned short get_srcport(struct rpc_xprt *xprt)
{
struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt);
- return xs_sock_getport(sock->sock);
+ unsigned short ret = 0;
+ mutex_lock(&sock->recv_mutex);
+ if (sock->sock)
+ ret = xs_sock_getport(sock->sock);
+ mutex_unlock(&sock->recv_mutex);
+ return ret;
}
EXPORT_SYMBOL(get_srcport);
---
base-commit: 1797d8bf8d0c2e74defad605d14e3553d43a3caf
change-id: 20260924-cve-2022-48816-11959ffacca3
Best regards,
--
Miguel Gazquez (Schneider Electric) <miguel.gazquez@bootlin.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 5.10.y] SUNRPC: lock against ->sock changing during sysfs read
2026-09-24 16:06 [PATCH 5.10.y] SUNRPC: lock against ->sock changing during sysfs read Miguel Gazquez (Schneider Electric)
@ 2026-09-25 18:47 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-09-25 18:47 UTC (permalink / raw)
To: stable, Trond Myklebust, Anna Schumaker, J. Bruce Fields,
Chuck Lever, David S. Miller, Jakub Kicinski, Olga Kornievskaia
Cc: Sasha Levin, Benjamin Robin, linux-nfs, netdev, linux-kernel,
Thomas Petazzoni, NeilBrown, Robert Garcia, Greg Kroah-Hartman,
Miguel Gazquez (Schneider Electric)
> [ Removed the changes about net/sunrpc/sysfs.c, as this file doesn't
> exist in 5.10 ]
Queued for 5.10, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-25 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 16:06 [PATCH 5.10.y] SUNRPC: lock against ->sock changing during sysfs read Miguel Gazquez (Schneider Electric)
2026-09-25 18:47 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®