From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Nihar Chaithanya <niharchaithanya@gmail.com>, shaggy@kernel.org
Cc: jfs-discussion@lists.sourceforge.net, skhan@linuxfoundation.org,
linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+412dea214d8baa3f7483@syzkaller.appspotmail.com
Subject: Re: [PATCH] jfs: add a check to prevent array-index-out-of-bounds
Date: Tue, 29 Oct 2024 17:39:46 -0500 [thread overview]
Message-ID: <f8ad2538-28e1-444e-94ca-1ede6e74e848@oracle.com> (raw)
In-Reply-To: <20241008202137.8577-1-niharchaithanya@gmail.com>
On 10/8/24 3:21PM, Nihar Chaithanya wrote:
> When the value of lp is 1 at the end of the iteration in the for loop,
> lp is modified in the next iteration to a negative value.
> Add a check to prevent this condition.
>
> Reported-by: syzbot+412dea214d8baa3f7483@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=412dea214d8baa3f7483
> Tested-by: syzbot+412dea214d8baa3f7483@syzkaller.appspotmail.com
> Signed-off-by: Nihar Chaithanya <niharchaithanya@gmail.com>
> ---
> fs/jfs/jfs_dmap.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
> index 5713994328cb..3ebb2dfdd0b3 100644
> --- a/fs/jfs/jfs_dmap.c
> +++ b/fs/jfs/jfs_dmap.c
> @@ -2911,6 +2911,12 @@ static void dbAdjTree(dmtree_t *tp, int leafno, int newval, bool is_ctl)
> */
> tp->dmt_stree[pp] = max;
>
> + /* check to prevent negative value of lp on the
> + * next iteration.
> + */
> + if (lp == 1)
> + break;
> +
I'm going to change this a little bit. I think it's a little cleaner to
test lp for zero at the top of the loop.
> /* parent becomes leaf for next go-round.
> */
> lp = pp;
That and rewording the commit message, I will apply this.
Thanks,
Shaggy
prev parent reply other threads:[~2024-10-29 22:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 20:21 Nihar Chaithanya
2024-10-29 22:39 ` 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=f8ad2538-28e1-444e-94ca-1ede6e74e848@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=niharchaithanya@gmail.com \
--cc=shaggy@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=syzbot+412dea214d8baa3f7483@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®