ksmbd: Fix read on the uninitialized pointer sess
authorColin Ian King <colin.king@canonical.com>
Tue, 6 Jul 2021 12:05:01 +0000 (13:05 +0100)
committerNamjae Jeon <namjae.jeon@samsung.com>
Tue, 6 Jul 2021 13:06:32 +0000 (22:06 +0900)
commit4951a84f61d6de4ab5aca1d49a6b6ee2ad2d1eec
tree3374da92a64b7ea2e4d4225df9a25e9b7a2ef4d4
parent465d720485eff1468503d210b1b966660f5f9b85
ksmbd: Fix read on the uninitialized pointer sess

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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/ksmbd/smb2pdu.c