OSDN Git Service

SUNRPC: lock against ->sock changing during sysfs read
authorNeilBrown <neilb@suse.de>
Mon, 17 Jan 2022 05:36:53 +0000 (16:36 +1100)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 8 Feb 2022 14:14:26 +0000 (09:14 -0500)
commitb49ea673e119f59c71645e2f65b3ccad857c90ee
treef2c725e739f87b03ccbc0cababb25d71026b1f9a
parent63db37e99ac17f575766c9317f927c8d4c6e8cdf
SUNRPC: lock against ->sock changing during sysfs read

->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.

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>
net/sunrpc/sysfs.c
net/sunrpc/xprtsock.c