Patch "CIFS: zero sensitive data when freeing" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
CIFS: zero sensitive data when freeing
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
cifs-zero-sensitive-data-when-freeing.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
97f4b7276b829a8927ac903a119bef2f963ccc58Mon Sep 17 00:00:00 2001
From: Aurelien Aptel <[email protected]>
Date: Thu, 25 Jan 2018 15:59:39 +0100
Subject: CIFS: zero sensitive data when freeing
From: Aurelien Aptel <[email protected]>
commit 97f4b7276b829a8927ac903a119bef2f963ccc58 upstream.
also replaces memset()+kfree() by kzfree().
--- fs/cifs/cifsencrypt.c | 3 +-- fs/cifs/connect.c | 6 +++--- fs/cifs/misc.c | 14 ++++---------- 3 files changed, 8 insertions(+), 15 deletions(-)
fs/cifs/cifsencrypt.c +1 -2
@@ -318,9 +318,8 @@ int calc_lanman_hash(const char *passwor {int i;int rc; -char password_with_pad[CIFS_ENCPWD_SIZE ]; +char password_with_pad[CIFS_ENCPWD_SIZE ] = {0 }; -memset (password_with_pad,0 ,CIFS_ENCPWD_SIZE );if (password)strncpy (password_with_pad, password,CIFS_ENCPWD_SIZE );
fs/cifs/connect.c +3 -3
@@ -1667,7 +1667,7 @@ cifs_parse_mount_options(const char *mou tmp_end++;if (!(tmp_end < end && tmp_end[1 ] == delim)) {/* No it is not. Set the password to NULL */ -kfree (vol->password); +kzfree (vol->password); vol->password =NULL ;break ; }
@@ -1705,7 +1705,7 @@ cifs_parse_mount_options(const char *mou options = end; } -kfree (vol->password); +kzfree (vol->password);/* Now build new password string */ temp_len =strlen (value); vol->password =kzalloc (temp_len+1 ,GFP_KERNEL );
@@ -4159,7 +4159,7 @@ cifs_construct_tcon(struct cifs_sb_inforeset_cifs_unix_caps (0 , tcon,NULL , vol_info); out:kfree (vol_info->username); -kfree (vol_info->password); +kzfree (vol_info->password);kfree (vol_info);return tcon;
fs/cifs/misc.c +4 -10
@@ -99,14 +99,11 @@ sesInfoFree(struct cifs_ses *buf_to_freekfree (buf_to_free->serverOS);kfree (buf_to_free->serverDomain);kfree (buf_to_free->serverNOS); -if (buf_to_free->password) { -memset (buf_to_free->password,0 ,strlen (buf_to_free->password)); -kfree (buf_to_free->password); - } +kzfree (buf_to_free->password);kfree (buf_to_free->user_name);kfree (buf_to_free->domainName); -kfree (buf_to_free->auth_key.response); -kfree (buf_to_free); +kzfree (buf_to_free->auth_key.response); +kzfree (buf_to_free); } struct cifs_tcon *
@@ -137,10 +134,7 @@ tconInfoFree(struct cifs_tcon *buf_to_fr }atomic_dec (&tconInfoAllocCount);kfree (buf_to_free->nativeFileSystem); -if (buf_to_free->password) { -memset (buf_to_free->password,0 ,strlen (buf_to_free->password)); -kfree (buf_to_free->password); - } +kzfree (buf_to_free->password);kfree (buf_to_free); }
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/cifs-zero-sensitive-data-when-freeing.patch