Skip to content

Commit

Permalink
nfsd: fix potential UAF in nfsd4_cb_getattr_release
Browse files Browse the repository at this point in the history
[ Upstream commit 1116e0e ]

Once we drop the delegation reference, the fields embedded in it are no
longer safe to access. Do that last.

Fixes: c596772 ("NFSD: handle GETATTR conflict with write delegation")
Signed-off-by: Jeff Layton <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
jtlayton authored and gregkh committed Sep 4, 2024
1 parent 1ca0cfd commit e0b6669
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -3078,9 +3078,9 @@ nfsd4_cb_getattr_release(struct nfsd4_callback *cb)
struct nfs4_delegation *dp =
container_of(ncf, struct nfs4_delegation, dl_cb_fattr);

nfs4_put_stid(&dp->dl_stid);
clear_bit(CB_GETATTR_BUSY, &ncf->ncf_cb_flags);
wake_up_bit(&ncf->ncf_cb_flags, CB_GETATTR_BUSY);
nfs4_put_stid(&dp->dl_stid);
}

static const struct nfsd4_callback_ops nfsd4_cb_recall_any_ops = {
Expand Down

0 comments on commit e0b6669

Please sign in to comment.