From: Xingyuan Mo Date: Wed, 11 Jan 2023 16:24:53 +0000 (+0800) Subject: NFSD: fix use-after-free in nfsd4_ssc_setup_dul() X-Git-Tag: v6.1.9~255 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32d5eb95f8f0e362e37c393310b13b9e95404560;p=platform%2Fkernel%2Flinux-starfive.git NFSD: fix use-after-free in nfsd4_ssc_setup_dul() [ Upstream commit e6cf91b7b47ff82b624bdfe2fdcde32bb52e71dd ] If signal_pending() returns true, schedule_timeout() will not be executed, causing the waiting task to remain in the wait queue. Fixed by adding a call to finish_wait(), which ensures that the waiting task will always be removed from the wait queue. Fixes: f4e44b393389 ("NFSD: delay unmount source's export after inter-server copy completed.") Signed-off-by: Xingyuan Mo Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 30a08ec..ba04ce9 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1331,6 +1331,7 @@ try_again: /* allow 20secs for mount/unmount for now - revisit */ if (signal_pending(current) || (schedule_timeout(20*HZ) == 0)) { + finish_wait(&nn->nfsd_ssc_waitq, &wait); kfree(work); return nfserr_eagain; }