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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Dan Carpenter 2021-08-02 08:14:03 +09:00 committed by Namjae Jeon
parent f1abdb78a1
commit 8b99f3504b

View File

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