* [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch()
@ 2019-03-02 1:17 ZhangXiaoxu
2019-03-04 1:10 ` zhangxiaoxu (A)
2019-03-11 9:13 ` Jan Kara
0 siblings, 2 replies; 5+ messages in thread
From: ZhangXiaoxu @ 2019-03-02 1:17 UTC (permalink / raw)
To: jack, amir73il, zhangxiaoxu5; +Cc: linux-fsdevel
Commit 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for
inotify_add_watch()") forgot to call fsnotify_put_mark() with
IN_MASK_CREATE after fsnotify_find_mark()
Fixes: 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for inotify_add_watch()")
Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
---
fs/notify/inotify/inotify_user.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 798f125..3b7b8e9 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -519,8 +519,10 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
if (!fsn_mark)
return -ENOENT;
- else if (create)
- return -EEXIST;
+ else if (create) {
+ ret = -EEXIST;
+ goto out;
+ }
i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
@@ -548,6 +550,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
/* return the wd */
ret = i_mark->wd;
+out:
/* match the get from fsnotify_find_mark() */
fsnotify_put_mark(fsn_mark);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch()
2019-03-02 1:17 [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch() ZhangXiaoxu
@ 2019-03-04 1:10 ` zhangxiaoxu (A)
2019-03-11 7:48 ` zhangxiaoxu (A)
2019-03-11 9:13 ` Jan Kara
1 sibling, 1 reply; 5+ messages in thread
From: zhangxiaoxu (A) @ 2019-03-04 1:10 UTC (permalink / raw)
To: jack, amir73il; +Cc: linux-fsdevel
ping.
On 3/2/2019 9:17 AM, ZhangXiaoxu wrote:
> Commit 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for
> inotify_add_watch()") forgot to call fsnotify_put_mark() with
> IN_MASK_CREATE after fsnotify_find_mark()
>
> Fixes: 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for inotify_add_watch()")
> Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
> ---
> fs/notify/inotify/inotify_user.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index 798f125..3b7b8e9 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -519,8 +519,10 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
> fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
> if (!fsn_mark)
> return -ENOENT;
> - else if (create)
> - return -EEXIST;
> + else if (create) {
> + ret = -EEXIST;
> + goto out;
> + }
>
> i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
>
> @@ -548,6 +550,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
> /* return the wd */
> ret = i_mark->wd;
>
> +out:
> /* match the get from fsnotify_find_mark() */
> fsnotify_put_mark(fsn_mark);
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch()
2019-03-04 1:10 ` zhangxiaoxu (A)
@ 2019-03-11 7:48 ` zhangxiaoxu (A)
2019-03-11 8:36 ` Amir Goldstein
0 siblings, 1 reply; 5+ messages in thread
From: zhangxiaoxu (A) @ 2019-03-11 7:48 UTC (permalink / raw)
To: jack, amir73il; +Cc: linux-fsdevel
ping.
On 3/4/2019 9:10 AM, zhangxiaoxu (A) wrote:
> ping.
>
> On 3/2/2019 9:17 AM, ZhangXiaoxu wrote:
>> Commit 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for
>> inotify_add_watch()") forgot to call fsnotify_put_mark() with
>> IN_MASK_CREATE after fsnotify_find_mark()
>>
>> Fixes: 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for inotify_add_watch()")
>> Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
>> ---
>> fs/notify/inotify/inotify_user.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
>> index 798f125..3b7b8e9 100644
>> --- a/fs/notify/inotify/inotify_user.c
>> +++ b/fs/notify/inotify/inotify_user.c
>> @@ -519,8 +519,10 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
>> fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
>> if (!fsn_mark)
>> return -ENOENT;
>> - else if (create)
>> - return -EEXIST;
>> + else if (create) {
>> + ret = -EEXIST;
>> + goto out;
>> + }
>> i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
>> @@ -548,6 +550,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
>> /* return the wd */
>> ret = i_mark->wd;
>> +out:
>> /* match the get from fsnotify_find_mark() */
>> fsnotify_put_mark(fsn_mark);
>>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch()
2019-03-11 7:48 ` zhangxiaoxu (A)
@ 2019-03-11 8:36 ` Amir Goldstein
0 siblings, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2019-03-11 8:36 UTC (permalink / raw)
To: zhangxiaoxu (A); +Cc: Jan Kara, linux-fsdevel
On Mon, Mar 11, 2019 at 9:49 AM zhangxiaoxu (A) <zhangxiaoxu5@huawei.com> wrote:
>
> ping.
Fix looks good.
Maintainer looks on vacation ;-)
Thanks,
Amir.
>
> On 3/4/2019 9:10 AM, zhangxiaoxu (A) wrote:
> > ping.
> >
> > On 3/2/2019 9:17 AM, ZhangXiaoxu wrote:
> >> Commit 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for
> >> inotify_add_watch()") forgot to call fsnotify_put_mark() with
> >> IN_MASK_CREATE after fsnotify_find_mark()
> >>
> >> Fixes: 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for inotify_add_watch()")
> >> Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
> >> ---
> >> fs/notify/inotify/inotify_user.c | 7 +++++--
> >> 1 file changed, 5 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> >> index 798f125..3b7b8e9 100644
> >> --- a/fs/notify/inotify/inotify_user.c
> >> +++ b/fs/notify/inotify/inotify_user.c
> >> @@ -519,8 +519,10 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
> >> fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
> >> if (!fsn_mark)
> >> return -ENOENT;
> >> - else if (create)
> >> - return -EEXIST;
> >> + else if (create) {
> >> + ret = -EEXIST;
> >> + goto out;
> >> + }
> >> i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
> >> @@ -548,6 +550,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
> >> /* return the wd */
> >> ret = i_mark->wd;
> >> +out:
> >> /* match the get from fsnotify_find_mark() */
> >> fsnotify_put_mark(fsn_mark);
> >>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch()
2019-03-02 1:17 [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch() ZhangXiaoxu
2019-03-04 1:10 ` zhangxiaoxu (A)
@ 2019-03-11 9:13 ` Jan Kara
1 sibling, 0 replies; 5+ messages in thread
From: Jan Kara @ 2019-03-11 9:13 UTC (permalink / raw)
To: ZhangXiaoxu; +Cc: jack, amir73il, linux-fsdevel
On Sat 02-03-19 09:17:32, ZhangXiaoxu wrote:
> Commit 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for
> inotify_add_watch()") forgot to call fsnotify_put_mark() with
> IN_MASK_CREATE after fsnotify_find_mark()
>
> Fixes: 4d97f7d53da7dc83 ("inotify: Add flag IN_MASK_CREATE for inotify_add_watch()")
> Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
Thanks for the patch! I've added it to my tree.
Honza
> ---
> fs/notify/inotify/inotify_user.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
> index 798f125..3b7b8e9 100644
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -519,8 +519,10 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
> fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
> if (!fsn_mark)
> return -ENOENT;
> - else if (create)
> - return -EEXIST;
> + else if (create) {
> + ret = -EEXIST;
> + goto out;
> + }
>
> i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
>
> @@ -548,6 +550,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
> /* return the wd */
> ret = i_mark->wd;
>
> +out:
> /* match the get from fsnotify_find_mark() */
> fsnotify_put_mark(fsn_mark);
>
> --
> 2.7.4
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-11 9:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-02 1:17 [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch() ZhangXiaoxu
2019-03-04 1:10 ` zhangxiaoxu (A)
2019-03-11 7:48 ` zhangxiaoxu (A)
2019-03-11 8:36 ` Amir Goldstein
2019-03-11 9:13 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).