diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2019-01-01 04:54:26 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-01-02 12:28:37 -0500 |
commit | 125892edfe69915a227d8d125ff0e1cd713178f4 (patch) | |
tree | 0293f1361d4c062211c3ce777806ee6c986add4c /fs/notify | |
parent | 8e143b90e4d45cca3dc53760d3cfab988bc74571 (diff) |
inotify: Fix fd refcount leak in inotify_add_watch().
Commit 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for
inotify_add_watch()") forgot to call fdput() before bailing out.
Fixes: 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for inotify_add_watch()")
CC: stable@vger.kernel.org
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 105576daca4a..798f1253141a 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -724,8 +724,10 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, | |||
724 | return -EBADF; | 724 | return -EBADF; |
725 | 725 | ||
726 | /* IN_MASK_ADD and IN_MASK_CREATE don't make sense together */ | 726 | /* IN_MASK_ADD and IN_MASK_CREATE don't make sense together */ |
727 | if (unlikely((mask & IN_MASK_ADD) && (mask & IN_MASK_CREATE))) | 727 | if (unlikely((mask & IN_MASK_ADD) && (mask & IN_MASK_CREATE))) { |
728 | return -EINVAL; | 728 | ret = -EINVAL; |
729 | goto fput_and_out; | ||
730 | } | ||
729 | 731 | ||
730 | /* verify that this is indeed an inotify instance */ | 732 | /* verify that this is indeed an inotify instance */ |
731 | if (unlikely(f.file->f_op != &inotify_fops)) { | 733 | if (unlikely(f.file->f_op != &inotify_fops)) { |