提交 d6ccf499 编写于 作者: N Namjae Jeon 提交者: Steve French

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: NNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: NAshish Sangwan <a.sangwan@samsung.com>
Signed-off-by: NSteve French <smfrench@gmail.com>
上级 27b7edcf
...@@ -1600,6 +1600,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1600,6 +1600,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
tmp_end++; tmp_end++;
if (!(tmp_end < end && tmp_end[1] == delim)) { if (!(tmp_end < end && tmp_end[1] == delim)) {
/* No it is not. Set the password to NULL */ /* No it is not. Set the password to NULL */
kfree(vol->password);
vol->password = NULL; vol->password = NULL;
break; break;
} }
...@@ -1637,6 +1638,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1637,6 +1638,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
options = end; options = end;
} }
kfree(vol->password);
/* Now build new password string */ /* Now build new password string */
temp_len = strlen(value); temp_len = strlen(value);
vol->password = kzalloc(temp_len+1, GFP_KERNEL); vol->password = kzalloc(temp_len+1, GFP_KERNEL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册