linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ksmbd: fix an oops in error handling in smb2_open()
@ 2021-07-29 14:15 Dan Carpenter
  2021-07-29 22:34 ` Namjae Jeon
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-07-29 14:15 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: Sergey Senozhatsky, Steve French, Hyunchul Lee, Ronnie Sahlberg,
	linux-cifs, kernel-janitors

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(+)

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;
 		}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ksmbd: fix an oops in error handling in smb2_open()
  2021-07-29 14:15 [PATCH] ksmbd: fix an oops in error handling in smb2_open() Dan Carpenter
@ 2021-07-29 22:34 ` Namjae Jeon
  0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2021-07-29 22:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Namjae Jeon, Sergey Senozhatsky, Steve French, Hyunchul Lee,
	Ronnie Sahlberg, linux-cifs, kernel-janitors

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!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-29 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 14:15 [PATCH] ksmbd: fix an oops in error handling in smb2_open() Dan Carpenter
2021-07-29 22:34 ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).