public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Edward Adam Davis <eadavis@qq.com>
Cc: axboe@kernel.dk, jfs-discussion@lists.sourceforge.net,
	kristian@klausen.dk, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH V2] jfs: add sanity check for agwidth in dbMount
Date: Thu, 20 Feb 2025 10:21:18 -0600	[thread overview]
Message-ID: <e8a54739-340f-45dd-9018-c32154d23ef5@oracle.com> (raw)
In-Reply-To: <tencent_7E9E541BBE4B3C1BCD256EBA87BB8733E308@qq.com>

On 2/20/25 5:24AM, Edward Adam Davis wrote:
> The width in dmapctl of the AG is zero, it trigger a divide error when
> calculating the control page level in dbAllocAG.
> 
> To avoid this issue, add a check for agwidth in dbAllocAG.

Looks good. Will add this to jfs-next.

Thanks,
Shaggy

> 
> Reported-and-tested-by: syzbot+7c808908291a569281a9@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=7c808908291a569281a9
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> V1 -> V2: move the check to dbMount
> 
>   fs/jfs/jfs_dmap.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
> index f9009e4f9ffd..62f55e7ed840 100644
> --- a/fs/jfs/jfs_dmap.c
> +++ b/fs/jfs/jfs_dmap.c
> @@ -204,6 +204,10 @@ int dbMount(struct inode *ipbmap)
>   	bmp->db_aglevel = le32_to_cpu(dbmp_le->dn_aglevel);
>   	bmp->db_agheight = le32_to_cpu(dbmp_le->dn_agheight);
>   	bmp->db_agwidth = le32_to_cpu(dbmp_le->dn_agwidth);
> +	if (!bmp->db_agwidth) {
> +		err = -EINVAL;
> +		goto err_release_metapage;
> +	}
>   	bmp->db_agstart = le32_to_cpu(dbmp_le->dn_agstart);
>   	bmp->db_agl2size = le32_to_cpu(dbmp_le->dn_agl2size);
>   	if (bmp->db_agl2size > L2MAXL2SIZE - L2MAXAG ||


      reply	other threads:[~2025-02-20 16:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03  4:02 [syzbot] [jfs?] divide error in dbAllocAG syzbot
2024-12-03  7:56 ` Edward Adam Davis
2024-12-03  8:21   ` syzbot
2024-12-03  8:53 ` Edward Adam Davis
2024-12-03  9:24   ` syzbot
2024-12-03  9:47 ` Edward Adam Davis
2024-12-03 10:24   ` syzbot
2024-12-03 10:22 ` [PATCH] jfs: check agwidth before calculating the control page level Edward Adam Davis
2025-02-19 21:20   ` [Jfs-discussion] " Dave Kleikamp
2025-02-20 11:24     ` [PATCH V2] jfs: add sanity check for agwidth in dbMount Edward Adam Davis
2025-02-20 16:21       ` Dave Kleikamp [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8a54739-340f-45dd-9018-c32154d23ef5@oracle.com \
    --to=dave.kleikamp@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=eadavis@qq.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=kristian@klausen.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox