]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit61c7c10bd6bf3c8012edde902f6d5610db470cf9
treef2c725e739f87b03ccbc0cababb25d71026b1f9a
parentbd53f7fa34b7734925eddd20c4802567db9229f5
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 9f759263746a ("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: 9f759263746a ("SUNRPC: Check if the xprt is connected before handling sysfs reads")
Fixes: ea56a96d4f9a ("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