summaryrefslogtreecommitdiff
path: root/fs/cifs/cifsencrypt.c
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@cjr.nz>2023-01-11 02:35:46 +0300
committerSteve French <stfrench@microsoft.com>2023-01-11 08:24:37 +0300
commit2fe58d977ee05da5bb89ef5dc4f5bf2dc15db46f (patch)
tree762d57d17801fac74445c5a8a19915d3898fdc5d /fs/cifs/cifsencrypt.c
parent22aeb01db7080e18c6aeb4361cc2556c9887099a (diff)
downloadlinux-2fe58d977ee05da5bb89ef5dc4f5bf2dc15db46f.tar.xz
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/cifsencrypt.c')
-rw-r--r--fs/cifs/cifsencrypt.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 5db73c0f792a..cbc18b4a9cb2 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -278,6 +278,7 @@ build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp)
* ( for NTLMSSP_AV_NB_DOMAIN_NAME followed by NTLMSSP_AV_EOL ) +
* unicode length of a netbios domain name
*/
+ kfree_sensitive(ses->auth_key.response);
ses->auth_key.len = size + 2 * dlen;
ses->auth_key.response = kzalloc(ses->auth_key.len, GFP_KERNEL);
if (!ses->auth_key.response) {