[PATCH 07/29] jffs2: remove from wait queue after schedule()

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jul 5 07:49:27 UTC 2018


From: Li Zefan <lizefan at huawei.com>

@wait is a local variable, so if we don't remove it from the wait queue
list, later wake_up() may end up accessing invalid memory.

This was spotted by eyes.

Signed-off-by: Li Zefan <lizefan at huawei.com>
Cc: David Woodhouse <dwmw2 at infradead.org>
Cc: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
Cc: <stable at vger.kernel.org>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>

1	0	cpukit/libfs/src/jffs2/src/nodemgmt.c

diff --git a/cpukit/libfs/src/jffs2/src/nodemgmt.c b/cpukit/libfs/src/jffs2/src/nodemgmt.c
index 40fa34c692..6cb8dc4d6f 100644
--- a/cpukit/libfs/src/jffs2/src/nodemgmt.c
+++ b/cpukit/libfs/src/jffs2/src/nodemgmt.c
@@ -181,6 +181,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
 					spin_unlock(&c->erase_completion_lock);
 
 					schedule();
+					remove_wait_queue(&c->erase_wait, &wait);
 				} else
 					spin_unlock(&c->erase_completion_lock);
 			} else if (ret)
-- 
2.13.7



More information about the devel mailing list