]> git.baikalelectronics.ru Git - kernel.git/commit
fanotify: Fix use after free in mask checking
authorJan Kara <jack@suse.cz>
Tue, 28 Jan 2014 17:29:24 +0000 (18:29 +0100)
committerJan Kara <jack@suse.cz>
Wed, 29 Jan 2014 12:57:04 +0000 (13:57 +0100)
commit607c8acacc6e841bcfd3455e1c4fdb7a2c145000
treebad7a21d6c43925fe4e7102f9816847ed133e775
parentfd63dea7a3517d0969d3fbbe3cde28dd80fcff78
fanotify: Fix use after free in mask checking

We cannot use the event structure returned from
fsnotify_add_notify_event() because that event can be freed by the time
that function returns. Use the mask argument passed into the event
handler directly instead. This also fixes a possible problem when we
could unnecessarily wait for permission response for a normal fanotify
event which got merged with a permission event.

We also disallow merging of permission event with any other event so
that we know the permission event which we just created is the one on
which we should wait for permission response.

Reported-and-tested-by: Jiri Kosina <jkosina@suse.cz>
Reported-and-tested-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/fanotify/fanotify.c