aboutsummaryrefslogtreecommitdiffstats
path: root/features/yaffs2/yaffs2-fix-memory-leak-when-proc-yaffs-is-read.patch
blob: 23c0ee483261a1c8ccd1fe60fa9a93cb882e2acb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From e64f1a1d9447f4def5e36c9278b433b19eec1798 Mon Sep 17 00:00:00 2001
From: Charles Manning <cdhmanning@gmail.com>
Date: Mon, 16 Mar 2020 16:52:51 +0800
Subject: [PATCH] yaffs2: fix memory leak when /proc/yaffs is read

commit  27f18203551940abf35826a66978daf1b8124c6b from
git://www.aleph1.co.uk/yaffs2

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>
Signed-off-by: Quanyang Wang <quanyang.wang@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 fs/yaffs2/yaffs_vfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
index d3f89e07401b..4fbd0a42ff3d 100644
--- a/fs/yaffs2/yaffs_vfs.c
+++ b/fs/yaffs2/yaffs_vfs.c
@@ -3697,6 +3697,7 @@ static struct file_operations procfs_ops = {
 	.open  = yaffs_proc_open,
 	.read  = seq_read,
 	.write = yaffs_proc_write,
+	.release = single_release,
 };
 
 static int yaffs_procfs_init(void)
-- 
2.19.1