[PATCH] ksmbd: fix an oops in error handling in smb2_open()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux