Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH 5/7] cifs: fix memory leak when password is supplied multiple times
@ 2014-08-20 10:39 Namjae Jeon
  2014-08-21  0:10 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Namjae Jeon @ 2014-08-20 10:39 UTC (permalink / raw)
  To: 'Steve French'
  Cc: 'Shirish Pargaonkar', 'Pavel Shilovsky',
	linux-cifs-u79uwXL29TY76Z2rM5mHXA, Ashish Sangwan

Unlikely but possible. When password is supplied multiple times, we have
to free the previous allocation.

Signed-off-by: Namjae Jeon <namjae.jeon-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Ashish Sangwan <a.sangwan-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 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 b4b6d10..91512fd 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 5/7] cifs: fix memory leak when password is supplied multiple times
  2014-08-20 10:39 [PATCH 5/7] cifs: fix memory leak when password is supplied multiple times Namjae Jeon
@ 2014-08-21  0:10 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2014-08-21  0:10 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: Shirish Pargaonkar, Pavel Shilovsky,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ashish Sangwan

merged into cifs-2.6.git for-next

On Wed, Aug 20, 2014 at 5:39 AM, Namjae Jeon <namjae.jeon-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote:
> Unlikely but possible. When password is supplied multiple times, we have
> to free the previous allocation.
>
> Signed-off-by: Namjae Jeon <namjae.jeon-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Ashish Sangwan <a.sangwan-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> ---
>  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 b4b6d10..91512fd 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -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
>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-21  0:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 10:39 [PATCH 5/7] cifs: fix memory leak when password is supplied multiple times Namjae Jeon
2014-08-21  0:10 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox