Skip to content
Commit 5838d444 authored by Jan Kara's avatar Jan Kara Committed by Linus Torvalds
Browse files

fanotify: fix double free of pending permission events



Commit 85816794 ("fanotify: Fix use after free for permission
events") introduced a double free issue for permission events which are
pending in group's notification queue while group is being destroyed.
These events are freed from fanotify_handle_event() but they are not
removed from groups notification queue and thus they get freed again
from fsnotify_flush_notify().

Fix the problem by removing permission events from notification queue
before freeing them if we skip processing access response.  Also expand
comments in fanotify_release() to explain group shutdown in detail.

Fixes: 85816794
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Reported-by: default avatarDouglas Leeder <douglas.leeder@sophos.com>
Tested-by: default avatarDouglas Leeder <douglas.leeder@sophos.com>
Reported-by: default avatarHeinrich Schuchard <xypron.glpk@gmx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8ba8fa91
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment