mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Manas Ghandat <ghandatmanas@gmail.com>,
	shaggy@kernel.org, liushixin2@huawei.com
Cc: linux-kernel@vger.kernel.org,
	jfs-discussion@lists.sourceforge.net,
	Linux-kernel-mentees@lists.linuxfoundation.org,
	syzbot+aea1ad91e854d0a83e04@syzkaller.appspotmail.com
Subject: Re: [PATCH] jfs: fix array-index-out-of-bounds in dbFindLeaf
Date: Sun, 3 Sep 2023 16:45:39 -0500	[thread overview]
Message-ID: <82009ea8-ad86-4829-b0a7-7dacda762aad@oracle.com> (raw)
In-Reply-To: <5dd9b332-49e3-877d-125b-1de5b46af4d5@gmail.com>

On 9/2/23 12:45PM, Manas Ghandat wrote:
> Actually I was talking about the stree attribute of dmtree which is 
> present in both dmaptree and dmapctl.
> 
> Link : 
> https://elixir.bootlin.com/linux/v6.5.1/source/fs/jfs/jfs_dmap.h#L168
> 
> Since it is an array we can add a check for the size of array like the 
> code below.
> 
> 
> +            if (x + n > (sizeof(tp->dmt_stree)/sizeof(s8)))
> +                 return -ENOSPC;

That will always evaluate to the same thing (the size of stree in 
dmapctl). It would be valid, since that is the larger number, but it 
wouldn't catch all overflows of dmaptree's stree.


> 
> On 01/09/23 22:38, Dave Kleikamp wrote:
>> On 8/31/23 10:19AM, Manas Ghandat wrote:
>>> I was wondering if we could implement a get_tree_size macro wherein 
>>> we could find the tree size so that we can do the comparison. SInce 
>>> the tp->dmt_stree is an array we can get its size and fix the out of 
>>> bounds. Would this thing work?
>>
>> dmtree_t is a union of two nearly identical structures that both 
>> contain an stree. The only real difference in the structures is the 
>> size of the stree, so dbFindLeaf doesn't really know which is being 
>> used by the caller.
>>

  reply	other threads:[~2023-09-03 21:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 16:52 Manas Ghandat
2023-08-29 18:38 ` Dave Kleikamp
2023-08-31 15:19   ` Manas Ghandat
2023-09-01 17:08     ` Dave Kleikamp
2023-09-02 17:45       ` Manas Ghandat
2023-09-03 21:45         ` Dave Kleikamp [this message]
2026-02-04  9:22 syzbot
2026-02-23 14:36 ` Dmitry Vyukov
2026-03-02 17:50   ` Dave Kleikamp

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=82009ea8-ad86-4829-b0a7-7dacda762aad@oracle.com \
    --to=dave.kleikamp@oracle.com \
    --cc=Linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=ghandatmanas@gmail.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liushixin2@huawei.com \
    --cc=shaggy@kernel.org \
    --cc=syzbot+aea1ad91e854d0a83e04@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®