diff options
author | Tetsuo Handa | 2019-01-01 10:54:26 +0100 |
---|---|---|
committer | Greg Kroah-Hartman | 2019-01-31 08:14:34 +0100 |
commit | a719cbe07847346f6f42a6133e231603d752c69d (patch) | |
tree | c62b564bed3940ae1ce23d224b4727c1d79796c5 /fs/notify/inotify/inotify_user.c | |
parent | clk: socfpga: stratix10: fix naming convention for the fixed-clocks (diff) | |
download | kernel-qcow2-linux-a719cbe07847346f6f42a6133e231603d752c69d.tar.gz kernel-qcow2-linux-a719cbe07847346f6f42a6133e231603d752c69d.tar.xz kernel-qcow2-linux-a719cbe07847346f6f42a6133e231603d752c69d.zip |
inotify: Fix fd refcount leak in inotify_add_watch().
commit 125892edfe69915a227d8d125ff0e1cd713178f4 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/notify/inotify/inotify_user.c')
-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 ac6978d3208c..780bba695453 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, 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)) { |