Skip to content

Commit

Permalink
Merge tag 'fsnotify_for_v5.0-rc4' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/kernel/git/jack/linux-fs

Pull inotify fix from Jan Kara:
 "Fix a file refcount leak in an inotify error path"

* tag 'fsnotify_for_v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
  inotify: Fix fd refcount leak in inotify_add_watch().
  • Loading branch information
torvalds committed Jan 24, 2019
2 parents 22a89a6 + 125892e commit c04e2a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/notify/inotify/inotify_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,10 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
return -EBADF;

/* IN_MASK_ADD and IN_MASK_CREATE don't make sense together */
if (unlikely((mask & IN_MASK_ADD) && (mask & IN_MASK_CREATE)))
return -EINVAL;
if (unlikely((mask & IN_MASK_ADD) && (mask & IN_MASK_CREATE))) {
ret = -EINVAL;
goto fput_and_out;
}

/* verify that this is indeed an inotify instance */
if (unlikely(f.file->f_op != &inotify_fops)) {
Expand Down

0 comments on commit c04e2a7

Please sign in to comment.