J. Bruce Fields 548ec0805c nfsd: fix use-after-free due to delegation race
A delegation break could arrive as soon as we've called vfs_setlease.  A
delegation break runs a callback which immediately (in
nfsd4_cb_recall_prepare) adds the delegation to del_recall_lru.  If we
then exit nfs4_set_delegation without hashing the delegation, it will be
freed as soon as the callback is done with it, without ever being
removed from del_recall_lru.

Symptoms show up later as use-after-free or list corruption warnings,
usually in the laundromat thread.

I suspect aba2072f4523 "nfsd: grant read delegations to clients holding
writes" made this bug easier to hit, but I looked as far back as v3.0
and it looks to me it already had the same problem.  So I'm not sure
where the bug was introduced; it may have been there from the beginning.

Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2021-12-10 11:55:15 -05:00
..
2021-02-23 13:39:45 -08:00
2021-01-25 09:36:28 -05:00
2021-10-02 15:51:10 -04:00
2021-10-02 15:51:10 -04:00
2020-09-25 18:01:26 -04:00
2021-01-24 14:27:17 +01:00
2021-10-02 15:51:10 -04:00
2021-09-21 18:21:34 -04:00
2021-12-10 11:54:59 -05:00
2021-10-02 15:51:10 -04:00
2021-10-02 15:51:10 -04:00
2021-10-19 10:36:48 -04:00
2021-01-25 09:36:28 -05:00
2021-11-01 17:17:14 -04:00
2018-09-25 20:34:54 -04:00