Skip to content

Commit a4cf3da

Browse files
Trond Myklebustgregkh
authored andcommitted
NFSv4/pnfs: Fix a use-after-free bug in open
commit 2135e5d upstream. 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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1e9fd95 commit a4cf3da

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
@@ -3106,12 +3106,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
31063106
}
31073107

31083108
out:
3109-
if (opendata->lgp) {
3110-
nfs4_lgopen_release(opendata->lgp);
3111-
opendata->lgp = NULL;
3112-
}
3113-
if (!opendata->cancelled)
3109+
if (!opendata->cancelled) {
3110+
if (opendata->lgp) {
3111+
nfs4_lgopen_release(opendata->lgp);
3112+
opendata->lgp = NULL;
3113+
}
31143114
nfs4_sequence_free_slot(&opendata->o_res.seq_res);
3115+
}
31153116
return ret;
31163117
}
31173118

0 commit comments

Comments
 (0)