]> git.baikalelectronics.ru Git - kernel.git/commit
nfs4: take a reference on the nfs_client when running FREE_STATEID
authorScott Mayhew <smayhew@redhat.com>
Wed, 3 Nov 2021 10:24:40 +0000 (06:24 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 3 Nov 2021 12:47:51 +0000 (08:47 -0400)
commit12ee8e9a5f814e1d5cf2100973fbe8f21f14927f
treefbc8c76b6b3c63888bc8457725da1506da41af11
parentb6dc1818174b79996d53cb4c71ff6eb2f12efd35
nfs4: take a reference on the nfs_client when running FREE_STATEID

During umount, the session slot tables are freed.  If there are
outstanding FREE_STATEID tasks, a use-after-free and slab corruption can
occur when rpc_exit_task calls rpc_call_done -> nfs41_sequence_done ->
nfs4_sequence_process/nfs41_sequence_free_slot.

Prevent that from happening by taking a reference on the nfs_client in
nfs41_free_stateid and putting it in nfs41_free_stateid_release.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4proc.c