summaryrefslogtreecommitdiff
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@cjr.nz>2023-01-10 20:35:46 -0300
committerSteve French <stfrench@microsoft.com>2023-01-10 23:24:37 -0600
commit2fe58d977ee05da5bb89ef5dc4f5bf2dc15db46f (patch)
tree762d57d17801fac74445c5a8a19915d3898fdc5d /fs/cifs/smb2pdu.c
parent22aeb01db7080e18c6aeb4361cc2556c9887099a (diff)
cifs: fix potential memory leaks in session setup
Make sure to free cifs_ses::auth_key.response before allocating it as we might end up leaking memory in reconnect or mounting. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r--fs/cifs/smb2pdu.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 727f16b426be..4b71f4a92f76 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1453,6 +1453,7 @@ SMB2_auth_kerberos(struct SMB2_sess_data *sess_data)
/* keep session key if binding */
if (!is_binding) {
+ kfree_sensitive(ses->auth_key.response);
ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len,
GFP_KERNEL);
if (!ses->auth_key.response) {