diff mbox series

ksmbd: fix an oops in error handling in smb2_open()

Message ID 20210729141534.GB1267@kili (mailing list archive)
State New, archived
Headers show
Series ksmbd: fix an oops in error handling in smb2_open() | expand

Commit Message

Dan Carpenter July 29, 2021, 2:15 p.m. UTC
If smb2_get_name() then "name" is an error pointer.  In the clean up
code, we try to kfree() it and that will lead to an Oops.  Set it to
NULL instead.

Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/ksmbd/smb2pdu.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Namjae Jeon July 29, 2021, 10:34 p.m. UTC | #1
2021-07-29 23:15 GMT+09:00, Dan Carpenter <dan.carpenter@oracle.com>:
> If smb2_get_name() then "name" is an error pointer.  In the clean up
> code, we try to kfree() it and that will lead to an Oops.  Set it to
> NULL instead.
>
> Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
I will apply, Thanks for your patch!
diff mbox series

Patch

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index c1a594599431..7e3cdd1b5b41 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -2462,6 +2462,7 @@  int smb2_open(struct ksmbd_work *work)
 			rc = PTR_ERR(name);
 			if (rc != -ENOMEM)
 				rc = -ENOENT;
+			name = NULL;
 			goto err_out1;
 		}