cifs: fix memory leak when password is supplied multiple times
Subsystems (2)
PATCH 5/7 cifs: fix memory leak when password is supplied multiple times
Unlikely but possible. When password is supplied multiple times, we have to free the previous allocation.
Signed-off-by Namjae Jeon <[email protected]>
Signed-off-by Ashish Sangwan <[email protected]>
--- fs/cifs/connect.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/cifs/connect.c +2 -0
@@ -1583,6 +1583,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,* Check if this is a case where the password * starts with a delimiter */ +kfree (vol->password); tmp_end =strchr (data,'=' ); tmp_end++;if (!(tmp_end < end && tmp_end[1 ] == delim)) {
@@ -1624,6 +1625,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, options = end; } +kfree (vol->password);/* Now build new password string */ temp_len =strlen (value); vol->password =kzalloc (temp_len+1 ,GFP_KERNEL );
Signature · 1 line
1.7.7
Steve French
Appliedmerged into cifs-2.6.git for-next
Quoted 32 lines · Namjae Jeon
Unlikely but possible. When password is supplied multiple times, we have to free the previous allocation.
Signed-off-by Namjae Jeon <[email protected]>Signed-off-by Ashish Sangwan <[email protected]>--- fs/cifs/connect.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)fs/cifs/connect.c +2
-1@@ -1583,6 +1583,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,* Check if this is a case where the password * starts with a delimiter */ +kfree (vol->password); tmp_end =strchr (data,'=' ); tmp_end++;if (!(tmp_end < end && tmp_end[1 ] == delim)) {@@ -1624,6 +1625,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, options = end; } +kfree (vol->password);/* Now build new password string */ temp_len =strlen (value); vol->password =kzalloc (temp_len+1 ,GFP_KERNEL ); --1.7.7
Signature · 3 lines
Thanks, Steve