diff options
author | Namjae Jeon <namjae.jeon@samsung.com> | 2014-08-21 19:11:20 +0900 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2014-08-21 12:06:57 -0500 |
commit | d6ccf4997e62fb6629f9f003980dca5292138b7b (patch) | |
tree | 7605256cd2e2ddd2a0a6e62083c2c5c3460bcc9d /fs/cifs | |
parent | 27b7edcf1ce03a3eddda24d4d271a9b29572a78b (diff) | |
download | linux-d6ccf4997e62fb6629f9f003980dca5292138b7b.tar.gz linux-d6ccf4997e62fb6629f9f003980dca5292138b7b.tar.bz2 linux-d6ccf4997e62fb6629f9f003980dca5292138b7b.zip |
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 <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 03ed8a09581c..36ca2045009b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -1600,6 +1600,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, tmp_end++; if (!(tmp_end < end && tmp_end[1] == delim)) { /* No it is not. Set the password to NULL */ + kfree(vol->password); vol->password = NULL; break; } @@ -1637,6 +1638,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); |