Re: [PATCH] inotify: Fix fsnotify_mark refcount leak in inotify_update_existing_watch()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 11, 2019 at 9:49 AM zhangxiaoxu (A) <zhangxiaoxu5@xxxxxxxxxx> 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@xxxxxxxxxx>
> >> ---
> >>   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);
> >>
>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux