Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6ccf499 authored by Namjae Jeon's avatar Namjae Jeon Committed by Steve French
Browse files

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: default avatarNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: default avatarAshish Sangwan <a.sangwan@samsung.com>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent 27b7edcf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);