aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <[email protected]>2021-03-18 16:12:54 +0300
committerSteve French <[email protected]>2021-05-10 19:15:20 -0500
commita2ba2709f5e465b316ef1f18605190d249847aad (patch)
tree877939cfa1e7e44048f8d25312b59d2af2651b68
parent8ef32967065737dac51974efae333436354bea0a (diff)
cifsd: Fix a use after free on error path
The ksmbd_free_work_struct() frees "work" so we need to swap the order of these two function calls to avoid a use after free. Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
-rw-r--r--fs/cifsd/oplock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifsd/oplock.c b/fs/cifsd/oplock.c
index 6c3dbc71134e..f694c14be0df 100644
--- a/fs/cifsd/oplock.c
+++ b/fs/cifsd/oplock.c
@@ -638,8 +638,8 @@ static void __smb2_oplock_break_noti(struct work_struct *wk)
if (allocate_oplock_break_buf(work)) {
ksmbd_err("smb2_allocate_rsp_buf failed! ");
atomic_dec(&conn->r_count);
- ksmbd_free_work_struct(work);
ksmbd_fd_put(work, fp);
+ ksmbd_free_work_struct(work);
return;
}