]> git.baikalelectronics.ru Git - kernel.git/commit
dnotify: Handle errors from fsnotify_add_mark_locked() in fcntl_dirnotify()
authorJan Kara <jack@suse.cz>
Tue, 31 Oct 2017 08:53:28 +0000 (09:53 +0100)
committerJan Kara <jack@suse.cz>
Tue, 31 Oct 2017 16:41:04 +0000 (17:41 +0100)
commitce02def3fbf35aa961a35575a86afcf295c5cec3
tree9372eb76b9f3d2242c2a6ac5c8724f7546cd5e98
parent5487b3a42601df0881c182b2c0c0b0ffe261c694
dnotify: Handle errors from fsnotify_add_mark_locked() in fcntl_dirnotify()

fsnotify_add_mark_locked() can fail but we do not check its return
value. This didn't matter before commit d0900460e6e4 "fsnotify: Move
mark list head from object into dedicated structure" as none of possible
failures could happen for dnotify but after that commit -ENOMEM can be
returned. Handle this error properly in fcntl_dirnotify() as
otherwise we just hit BUG_ON(dn_mark->dn) in dnotify_free_mark().

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reported-by: syzkaller
Fixes: d0900460e6e4cb98ff56f0bb73e75662e2528a24
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/dnotify/dnotify.c