lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKFNMom=ZM+YBCr-5UcjxGZY9O75RpNM4O4UqDecZPOgMqtctg@mail.gmail.com>
Date:   Sat, 19 Aug 2023 00:45:29 +0900
From:   Ryusuke Konishi <konishi.ryusuke@...il.com>
To:     Ferry Meng <mengferry@...ux.alibaba.com>
Cc:     linux-nilfs@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] nilfs2: fix dereferencing freed memory

On Fri, Aug 18, 2023 at 6:20 PM Ferry Meng wrote:
>
> Fix smatch warning:
>
> fs/nilfs2/gcinode.c:103 nilfs_gccache_submit_read_data() error:
> dereferencing freed memory 'bh'
>
> Signed-off-by: Ferry Meng <mengferry@...ux.alibaba.com>
>
> diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
> index 48fe71d309cb..6319e825f317 100644
> --- a/fs/nilfs2/gcinode.c
> +++ b/fs/nilfs2/gcinode.c
> @@ -73,10 +73,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
>                 struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
>
>                 err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
> -               if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
> -                       brelse(bh);
> +               if (unlikely(err)) /* -EIO, -ENOMEM, -ENOENT */
>                         goto failed;
> -               }
>         }
>
>         lock_buffer(bh);
> @@ -102,6 +100,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
>   failed:
>         unlock_page(bh->b_page);
>         put_page(bh->b_page);
> +       if (err)
> +               brelse(bh);
>         return err;
>  }
>
> --
> 2.19.1.6.gb485710b
>

Ah, this is almost identical to the patch Pan Bian sent me earlier.
After a closer look, I'll pick up his patch instead with a
"Reported-by" tag of your name on it.

Anyway, thanks for your feedback.

Regards,
Ryusuke Konishi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ