From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Edward Adam Davis <eadavis@qq.com>,
syzbot+dca05492eff41f604890@syzkaller.appspotmail.com
Cc: jfs-discussion@lists.sourceforge.net,
syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [Jfs-discussion] [PATCH] jfs: check if dmt_leafidx is less than zero
Date: Fri, 26 Jul 2024 09:52:27 -0500 [thread overview]
Message-ID: <c8b1c258-740a-412f-ae0b-4d68a53e698f@oracle.com> (raw)
In-Reply-To: <tencent_8FB36BE36BC97A03AE44421765577706C905@qq.com>
On 7/26/24 9:22AM, Edward Adam Davis via Jfs-discussion wrote:
> syzbot report a out of bounds in dbSplit, it because dmt_leafidx less
> than 0, add a checking for dmt_leafidx in dbAllocDmapLev.
This addresses the particular case, but I wonder if it would be a little
more robust to move the check into dbFindLeaf(). It would also catch a
similar issue when called from dbFindCtl().
>
> Reported-by: syzbot+dca05492eff41f604890@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=dca05492eff41f604890
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> fs/jfs/jfs_dmap.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
> index cb3cda1390ad..c5b8883599e3 100644
> --- a/fs/jfs/jfs_dmap.c
> +++ b/fs/jfs/jfs_dmap.c
> @@ -1956,6 +1956,7 @@ dbAllocDmapLev(struct bmap * bmp,
> {
> s64 blkno;
> int leafidx, rc;
> + dmtree_t *tp = (dmtree_t *) &dp->tree;
>
> /* can't be more than a dmaps worth of blocks */
> assert(l2nb <= L2BPERDMAP);
> @@ -1964,10 +1965,10 @@ dbAllocDmapLev(struct bmap * bmp,
> * free space. if sufficient free space is found, dbFindLeaf()
> * returns the index of the leaf at which free space was found.
> */
> - if (dbFindLeaf((dmtree_t *) &dp->tree, l2nb, &leafidx, false))
> + if (dbFindLeaf(tp, l2nb, &leafidx, false))
> return -ENOSPC;
>
> - if (leafidx < 0)
> + if (leafidx < 0 || le32_to_cpu(tp->dmt_leafidx) < 0)
> return -EIO;
>
> /* determine the block number within the file system corresponding
next prev parent reply other threads:[~2024-07-26 14:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 5:45 [syzbot] [jfs?] UBSAN: array-index-out-of-bounds in dbSplit syzbot
2024-07-26 13:40 ` Edward Adam Davis
2024-07-26 17:18 ` syzbot
2024-07-26 14:22 ` [PATCH] jfs: check if dmt_leafidx is less than zero Edward Adam Davis
2024-07-26 14:52 ` Dave Kleikamp [this message]
2024-07-27 1:42 ` [PATCH V2] jfs: check if leafidx greater than num leaves per dmap tree Edward Adam Davis
2024-08-23 18:30 ` Dave Kleikamp
2024-08-24 1:25 ` [PATCH V3] " Edward Adam Davis
2024-08-27 16:23 ` Dave Kleikamp
2024-07-27 1:08 ` [syzbot] [jfs?] UBSAN: array-index-out-of-bounds in dbSplit Edward Adam Davis
2024-07-27 1:32 ` syzbot
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=c8b1c258-740a-412f-ae0b-4d68a53e698f@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=eadavis@qq.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+dca05492eff41f604890@syzkaller.appspotmail.com \
--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
all inboxes | Powered by JetHome®