Skip to content

Commit 23e0a19

Browse files
committed
NFSv4/pnfs: Fix a use-after-free bug in open
jira LE-3201 Rebuild_History Non-Buildable kernel-rt-4.18.0-553.22.1.rt7.363.el8_10 commit-author Trond Myklebust <trond.myklebust@hammerspace.com> commit 2135e5d If someone cancels the open RPC call, then we must not try to free either the open slot or the layoutget operation arguments, since they are likely still in use by the hung RPC call. Fixes: 6949493 ("NFSv4: Don't hold the layoutget locks across multiple RPC calls") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> (cherry picked from commit 2135e5d) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent a4afe03 commit 23e0a19

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

fs/nfs/nfs4proc.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3117,12 +3117,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
31173117
}
31183118

31193119
out:
3120-
if (opendata->lgp) {
3121-
nfs4_lgopen_release(opendata->lgp);
3122-
opendata->lgp = NULL;
3123-
}
3124-
if (!opendata->cancelled)
3120+
if (!opendata->cancelled) {
3121+
if (opendata->lgp) {
3122+
nfs4_lgopen_release(opendata->lgp);
3123+
opendata->lgp = NULL;
3124+
}
31253125
nfs4_sequence_free_slot(&opendata->o_res.seq_res);
3126+
}
31263127
return ret;
31273128
}
31283129

0 commit comments

Comments
 (0)