From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Manas Ghandat <ghandatmanas@gmail.com>
Cc: Linux-kernel-mentees@lists.linuxfoundation.org,
jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
syzbot+79d792676d8ac050949f@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] jfs: fix array-index-out-of-bounds in diAlloc
Date: Wed, 4 Oct 2023 09:23:36 -0500 [thread overview]
Message-ID: <b0fcc552-a5b1-44cc-a3f6-da992249acb5@oracle.com> (raw)
In-Reply-To: <20231004074040.12233-1-ghandatmanas@gmail.com>
On 10/4/23 2:40AM, Manas Ghandat wrote:
> Currently there is not check against the agno of the iag while
> allocating new inodes to avoid fragmentation problem. Added the check
> which is required.
Applied to jfs-next
Thanks,
Shaggy
>
> Reported-by: syzbot+79d792676d8ac050949f@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=79d792676d8ac050949f
> Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
> ---
> V1 -> V2 : Added check for higher bound of agno
> fs/jfs/jfs_imap.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
> index 799d3837e7c2..c0cf74e7392b 100644
> --- a/fs/jfs/jfs_imap.c
> +++ b/fs/jfs/jfs_imap.c
> @@ -1319,7 +1319,7 @@ diInitInode(struct inode *ip, int iagno, int ino, int extno, struct iag * iagp)
> int diAlloc(struct inode *pip, bool dir, struct inode *ip)
> {
> int rc, ino, iagno, addext, extno, bitno, sword;
> - int nwords, rem, i, agno;
> + int nwords, rem, i, agno, dn_numag;
> u32 mask, inosmap, extsmap;
> struct inode *ipimap;
> struct metapage *mp;
> @@ -1355,6 +1355,9 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
>
> /* get the ag number of this iag */
> agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb));
> + dn_numag = JFS_SBI(pip->i_sb)->bmap->db_numag;
> + if (agno < 0 || agno > dn_numag)
> + return -EIO;
>
> if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) {
> /*
prev parent reply other threads:[~2023-10-04 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 7:40 Manas Ghandat
2023-10-04 14:23 ` 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=b0fcc552-a5b1-44cc-a3f6-da992249acb5@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=syzbot+79d792676d8ac050949f@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®