mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manas Ghandat <ghandatmanas@gmail.com>
To: shaggy@kernel.org, liushixin2@huawei.com
Cc: Manas Ghandat <ghandatmanas@gmail.com>,
	jfs-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Linux-kernel-mentees@lists.linuxfoundation.org,
	syzbot+91ad2b52815a08caf4ea@syzkaller.appspotmail.com
Subject: [PATCH] jfs : fix shift-out-of-bounds in dbUpdatePMap
Date: Sun, 27 Aug 2023 10:35:13 +0530	[thread overview]
Message-ID: <20230827050513.364567-1-ghandatmanas@gmail.com> (raw)

Currently there is no bound check for number of logical blocks per
page (bmp->db_l2nbperpage). Added the required bound check for the
calculation of dmap.

Reported-by: syzbot+91ad2b52815a08caf4ea@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=91ad2b52815a08caf4ea
Fixes: 4d81715fc5df ("[PATCH] fs/jfs: Conversion to generic boolean")
Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
---
 fs/jfs/jfs_dmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index a3eb1e826947..6a5df296fdc8 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -467,6 +467,10 @@ dbUpdatePMap(struct inode *ipbmap,
 	lastlblkno = 0;
 	for (rem = nblocks; rem > 0; rem -= nblks, blkno += nblks) {
 		/* get the buffer for the current dmap. */
+
+		if (bmp->db_l2nbperpage > L2BPERDMAP)
+			return -EIO;
+
 		lblkno = BLKTODMAP(blkno, bmp->db_l2nbperpage);
 		if (lblkno != lastlblkno) {
 			if (mp) {
-- 
2.37.2


             reply	other threads:[~2023-08-27  5:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27  5:05 Manas Ghandat [this message]
2023-08-29 17:49 ` Dave Kleikamp
2023-08-30 16:58   ` Manas Ghandat
2023-08-30 20:20     ` 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=20230827050513.364567-1-ghandatmanas@gmail.com \
    --to=ghandatmanas@gmail.com \
    --cc=Linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liushixin2@huawei.com \
    --cc=shaggy@kernel.org \
    --cc=syzbot+91ad2b52815a08caf4ea@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®