Skip to content

Commit 2135e5d

Browse files
author
Trond Myklebust
committed
NFSv4/pnfs: Fix a use-after-free bug in open
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>
1 parent b1a28f2 commit 2135e5d

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
@@ -3096,12 +3096,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
30963096
}
30973097

30983098
out:
3099-
if (opendata->lgp) {
3100-
nfs4_lgopen_release(opendata->lgp);
3101-
opendata->lgp = NULL;
3102-
}
3103-
if (!opendata->cancelled)
3099+
if (!opendata->cancelled) {
3100+
if (opendata->lgp) {
3101+
nfs4_lgopen_release(opendata->lgp);
3102+
opendata->lgp = NULL;
3103+
}
31043104
nfs4_sequence_free_slot(&opendata->o_res.seq_res);
3105+
}
31053106
return ret;
31063107
}
31073108

0 commit comments

Comments
 (0)