]> git.baikalelectronics.ru Git - kernel.git/commit
fanotify: fix FAN_Q_OVERFLOW case of fanotify_read()
authorAl Viro <viro@ZenIV.linux.org.uk>
Sun, 18 Nov 2012 19:19:00 +0000 (19:19 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 18 Nov 2012 19:30:00 +0000 (09:30 -1000)
commit10862fb060ef5ff6577778fe4f6515b5d71f2388
tree71f29d988cb6a1ac7f1c258dc003a9d252ea72f6
parentb20d991ed22e7d82b9b9350fdff2ff03ed82cd16
fanotify: fix FAN_Q_OVERFLOW case of fanotify_read()

If the FAN_Q_OVERFLOW bit set in event->mask, the fanotify event
metadata will not contain a valid file descriptor, but
copy_event_to_user() didn't check for that, and unconditionally does a
fd_install() on the file descriptor.

Which in turn will cause a BUG_ON() in __fd_install().

Introduced by commit 08bbc1450b83 ("fanotify: sanitize failure exits in
copy_event_to_user()")

Mea culpa - missed that path ;-/

Reported-by: Alex Shi <lkml.alex@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/notify/fanotify/fanotify_user.c