Răsfoiți Sursa

Free the memory allocated by memdup_user() in fs/sysfs/bin.c

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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Catalin Marinas 16 ani în urmă
părinte
comite
d5ce5b40bc
1 a modificat fișierele cu 1 adăugiri și 0 ștergeri
  1. 1 0
      fs/sysfs/bin.c

+ 1 - 0
fs/sysfs/bin.c

@@ -171,6 +171,7 @@ static ssize_t write(struct file *file, const char __user *userbuf,
 	if (count > 0)
 	if (count > 0)
 		*off = offs + count;
 		*off = offs + count;
 
 
+	kfree(temp);
 	return count;
 	return count;
 }
 }