Skip to content

Commit

Permalink
jffs2: remove from wait queue after schedule()
Browse files Browse the repository at this point in the history
@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@huawei.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  • Loading branch information
Li Zefan authored and Brian Norris committed Mar 11, 2014
1 parent f4f6a0b commit 3ead957
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/jffs2/nodemgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,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)
Expand Down

0 comments on commit 3ead957

Please sign in to comment.