fix memory leak when /proc/yaffs is read
authorCharles Manning <cdhmanning@gmail.com>
Mon, 21 Oct 2019 19:46:14 +0000 (08:46 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Mon, 21 Oct 2019 19:48:12 +0000 (08:48 +1300)
Thanks to Jisheng Zhang <Jisheng.Zhang@synaptics.com> for supplying this patch

There is a kernel memory leak observed when the proc file /proc/yaffs
is read. This reason is that in yaffs_proc_open, single_open is called
and the respective release function is not called during release.

Fix with correct release function - single_release().

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
yaffs_vfs_multi.c

index a36d9bfaa9d2ba8c21bcf5af02095ab947b07002..e4edb2cb357e328f8c906c7b01cf02ba9dd13a5a 100644 (file)
@@ -3687,6 +3687,7 @@ static struct file_operations procfs_ops = {
        .open  = yaffs_proc_open,
        .read  = seq_read,
        .write = yaffs_proc_write,
        .open  = yaffs_proc_open,
        .read  = seq_read,
        .write = yaffs_proc_write,
+       .release = single_release,
 };
 
 static int yaffs_procfs_init(void)
 };
 
 static int yaffs_procfs_init(void)