Skip to contentSkip to conversation

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

PATCH In review Dan Carpenter 2 participants 2 messages Jul 29, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ksmbd: fix an oops in error handling in smb2_open()

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")
---
 fs/ksmbd/smb2pdu.c | 1 +
 1 file changed, 1 insertion(+)
fs/ksmbd/smb2pdu.c +1 -0
index c1a594599431..7e3cdd1b5b41 100644
@@ -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;
 		}
 
Signature · 1 line
2.20.1
maintainer
#1 lore raw

2021-07-29 23:15 GMT+09:00, Dan Carpenter <[email protected]>:

Quoted 6 lines

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")

I will apply, Thanks for your patch!