public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Free the memory allocated by memdup_user() in fs/sysfs/bin.c
@ 2009-07-08 10:17 Catalin Marinas
  2009-07-12 14:57 ` Eric W. Biederman
  0 siblings, 1 reply; 2+ messages in thread
From: Catalin Marinas @ 2009-07-08 10:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andrew Morton, Parag Warudkar, linux-kernel

Commit 1c8542c7bb replaced kmalloc() with memdup_user() in the write()
function but also dropped the kfree(temp). The memdup_user() function
allocates memory which is never freed.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Parag Warudkar <parag.warudkar@gmail.com>
---
 fs/sysfs/bin.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 9345806..2524714 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -171,6 +171,7 @@ static ssize_t write(struct file *file, const char __user *userbuf,
 	if (count > 0)
 		*off = offs + count;
 
+	kfree(temp);
 	return count;
 }
 


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

* Re: [PATCH] Free the memory allocated by memdup_user() in fs/sysfs/bin.c
  2009-07-08 10:17 [PATCH] Free the memory allocated by memdup_user() in fs/sysfs/bin.c Catalin Marinas
@ 2009-07-12 14:57 ` Eric W. Biederman
  0 siblings, 0 replies; 2+ messages in thread
From: Eric W. Biederman @ 2009-07-12 14:57 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Linus Torvalds, Andrew Morton, Parag Warudkar, linux-kernel,
	Greg Kroah-Hartman, Al Viro

Catalin Marinas <catalin.marinas@arm.com> writes:

> Commit 1c8542c7bb replaced kmalloc() with memdup_user() in the write()
> function but also dropped the kfree(temp). The memdup_user() function
> allocates memory which is never freed.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Parag Warudkar <parag.warudkar@gmail.com>
> ---
>  fs/sysfs/bin.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
> index 9345806..2524714 100644
> --- a/fs/sysfs/bin.c
> +++ b/fs/sysfs/bin.c
> @@ -171,6 +171,7 @@ static ssize_t write(struct file *file, const char __user *userbuf,
>  	if (count > 0)
>  		*off = offs + count;
>  
> +	kfree(temp);
>  	return count;
>  }
>  
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2009-07-12 14:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-08 10:17 [PATCH] Free the memory allocated by memdup_user() in fs/sysfs/bin.c Catalin Marinas
2009-07-12 14:57 ` Eric W. Biederman

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