* [PATCH][next] ksmbd: Fix read on the uninitialized pointer sess
@ 2021-07-06 12:05 Colin King
2021-07-06 12:43 ` Namjae Jeon
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-07-06 12:05 UTC (permalink / raw)
To: Namjae Jeon, Sergey Senozhatsky, Steve French, Hyunchul Lee, linux-cifs
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
There is a error handling case that passes control to label out_err
without pointer sess being assigned a value. The unassigned pointer
may be any garbage value and so the test of rc < 0 && sess maybe
true leading to sess being passed to the call to ksmbd_session_destroy.
Fix this by setting sess to NULL in this corner case.
Addresses-Coverity: ("Uninitialized pointer read")
Fixes: f5a544e3bab7 ("ksmbd: add support for SMB3 multichannel")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
fs/ksmbd/smb2pdu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index dda90812feef..ad976dbbb0b6 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -1615,6 +1615,7 @@ int smb2_sess_setup(struct ksmbd_work *work)
} else if ((conn->dialect < SMB30_PROT_ID ||
server_conf.flags & KSMBD_GLOBAL_FLAG_SMB3_MULTICHANNEL) &&
(req->Flags & SMB2_SESSION_REQ_FLAG_BINDING)) {
+ sess = NULL;
rc = -EACCES;
goto out_err;
} else {
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] ksmbd: Fix read on the uninitialized pointer sess
2021-07-06 12:05 [PATCH][next] ksmbd: Fix read on the uninitialized pointer sess Colin King
@ 2021-07-06 12:43 ` Namjae Jeon
0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2021-07-06 12:43 UTC (permalink / raw)
To: Colin King
Cc: Namjae Jeon, Sergey Senozhatsky, Steve French, Hyunchul Lee,
linux-cifs, kernel-janitors, linux-kernel
Hi Colin,
2021-07-06 21:05 GMT+09:00, Colin King <colin.king@canonical.com>:
> From: Colin Ian King <colin.king@canonical.com>
>
> There is a error handling case that passes control to label out_err
> without pointer sess being assigned a value. The unassigned pointer
> may be any garbage value and so the test of rc < 0 && sess maybe
> true leading to sess being passed to the call to ksmbd_session_destroy.
> Fix this by setting sess to NULL in this corner case.
>
> Addresses-Coverity: ("Uninitialized pointer read")
> Fixes: f5a544e3bab7 ("ksmbd: add support for SMB3 multichannel")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
I will apply this patch. Thanks for your patch!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-06 12:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 12:05 [PATCH][next] ksmbd: Fix read on the uninitialized pointer sess Colin King
2021-07-06 12:43 ` 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).