From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Ghanshyam Agrawal <ghanshyam1898@gmail.com>,
ghandatmanas@gmail.com, juntong.deng@outlook.com,
aha310510@gmail.com, peili.dev@gmail.com, eadavis@qq.com
Cc: jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
syzbot+b5ca8a249162c4b9a7d0@syzkaller.appspotmail.com
Subject: Re: [PATCH] jfs: fix shift-out-of-bounds in dbSplit
Date: Tue, 29 Oct 2024 16:53:04 -0500 [thread overview]
Message-ID: <27591dea-ba0b-4193-9335-680aa96441ef@oracle.com> (raw)
In-Reply-To: <20240930081218.2992648-1-ghanshyam1898@gmail.com>
On 9/30/24 3:12AM, Ghanshyam Agrawal wrote:
> When dmt_budmin is less than zero, it causes errors
> in the later stages. Added a check to return an error beforehand
> in dbAllocCtl itself.
>
> Reported-by: syzbot+b5ca8a249162c4b9a7d0@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=b5ca8a249162c4b9a7d0
> Signed-off-by: Ghanshyam Agrawal <ghanshyam1898@gmail.com>
> ---
> fs/jfs/jfs_dmap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
> index 974ecf5e0d95..f65a07252c22 100644
> --- a/fs/jfs/jfs_dmap.c
> +++ b/fs/jfs/jfs_dmap.c
> @@ -1808,6 +1808,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
> s64 b, lblkno, n;
> struct metapage *mp;
> struct dmap *dp;
> + dmtree_t *tp;
>
> /* check if the allocation request is confined to a single dmap.
> */
> @@ -1819,6 +1820,10 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
> if (mp == NULL)
> return -EIO;
> dp = (struct dmap *) mp->data;
> + tp = (dmtree_t *) &dp->tree;
> +
> + if (tp->dmt_budmin < 0)
> + return -EIO;
I'm simplifying this to:
if (dp->tree.budmin < 0)
return -EIO;
>
> /* try to allocate the blocks.
> */
Other than that. It looks good. I'll apply it.
Shaggy
prev parent reply other threads:[~2024-10-29 21:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 8:12 Ghanshyam Agrawal
2024-10-29 21:53 ` 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=27591dea-ba0b-4193-9335-680aa96441ef@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=aha310510@gmail.com \
--cc=eadavis@qq.com \
--cc=ghandatmanas@gmail.com \
--cc=ghanshyam1898@gmail.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=juntong.deng@outlook.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peili.dev@gmail.com \
--cc=syzbot+b5ca8a249162c4b9a7d0@syzkaller.appspotmail.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®