Skip to content

Commit

Permalink
Free the memory allocated by memdup_user() in fs/sysfs/bin.c
Browse files Browse the repository at this point in the history
Commit 1c8542c 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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Catalin Marinas authored and Linus Torvalds committed Jul 8, 2009
1 parent 5e75c5f commit d5ce5b4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/sysfs/bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit d5ce5b4

Please sign in to comment.