All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+553d90297e6d2f50dbc7@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] [jfs?] UBSAN: array-index-out-of-bounds in diNewExt
Date: Mon, 11 Dec 2023 04:30:30 -0800	[thread overview]
Message-ID: <000000000000775780060c3b19d2@google.com> (raw)
In-Reply-To: <00000000000062a4cc060c2217de@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [jfs?] UBSAN: array-index-out-of-bounds in diNewExt
Author: eadavis@qq.com

please test array-index-out-of-bounds in diNewExt

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bee0e7762ad2

diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index a037ee59e398..8fc28b655060 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -1341,6 +1341,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
 	 */
 	if (dir) {
 		agno = dbNextAG(JFS_SBI(pip->i_sb)->ipbmap);
+		printk("agno/dbNextAG: %d, %s\n", agno, __func__);
 		AG_LOCK(imap, agno);
 		goto tryag;
 	}
@@ -1356,6 +1357,7 @@ 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));
+	printk("agno/agstart: %d, %s\n", agno, __func__);
 	dn_numag = JFS_SBI(pip->i_sb)->bmap->db_numag;
 	if (agno < 0 || agno > dn_numag)
 		return -EIO;
@@ -1584,6 +1586,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)
 	/*
 	 * try to allocate anywhere within the same AG as the parent inode.
 	 */
+	printk("agno: %d, %s\n", agno, __func__);
 	rc = diAllocAG(imap, agno, dir, ip);
 
 	AG_UNLOCK(imap, agno);
@@ -2179,6 +2182,9 @@ static int diNewExt(struct inomap * imap, struct iag * iagp, int extno)
 	/* get the ag and iag numbers for this iag.
 	 */
 	agno = BLKTOAG(le64_to_cpu(iagp->agstart), sbi);
+	if (agno > MAXAG || agno < 0)
+		return -EINVAL;
+
 	iagno = le32_to_cpu(iagp->iagnum);
 
 	/* check if this is the last free extent within the


  parent reply	other threads:[~2023-12-11 12:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-10  6:40 [syzbot] [jfs?] UBSAN: array-index-out-of-bounds in diNewExt syzbot
2023-12-10  7:24 ` syzbot
2023-12-11 12:30 ` syzbot [this message]
2023-12-12  0:30 ` syzbot
2023-12-12  1:36 ` [PATCH] jfs: fix " Edward Adam Davis
2023-12-20 20:02   ` Dave Kleikamp
2024-01-02 13:29   ` Dan Carpenter
2024-01-02 17:10     ` Dave Kleikamp
     [not found] <tencent_B4064DC995AEF2AEC3CC9E27EE06ED12D706@qq.com>
2023-12-10  7:36 ` [syzbot] [jfs?] UBSAN: " syzbot
     [not found] <tencent_996A377566D793682361297D63A5244B3705@qq.com>
2023-12-11 12:50 ` syzbot
     [not found] <tencent_5FBE6E042F496EB89494EB7AED4ECD84780A@qq.com>
2023-12-12  1:04 ` 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=000000000000775780060c3b19d2@google.com \
    --to=syzbot+553d90297e6d2f50dbc7@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.