Linux Overlay Filesystem development
 help / color / mirror / Atom feed
From: Tamil Mathi <9tamilmathi@gmail.com>
To: paullawrence@google.com
Cc: linux-unionfs@vger.kernel.org, kernel-team@android.com,
	syzbot+75ff1aecfbeeefb78736@syzkaller.appspotmail.com,
	Tamil Mathi <9tamilmathi@gmail.com>
Subject: [PATCH] incfs: validate rlog_pages mount option against MAX_ORDER_NR_PAGES
Date: Thu, 23 Apr 2026 21:59:54 -0700	[thread overview]
Message-ID: <20260424045954.3187-1-9tamilmathi@gmail.com> (raw)

The rlog_pages mount option is parsed from user-supplied mount data and
used directly to compute the read log ring buffer size:

  new_buffer_size = PAGE_SIZE * options->read_log_pages;
  new_buffer = kzalloc(new_buffer_size, GFP_NOFS);

kzalloc() for a contiguous allocation larger than MAX_ORDER_NR_PAGES
pages triggers WARN_ON(order > MAX_ORDER) in __alloc_pages_noprof().
A user can pass rlog_pages=22472 (~88 MB) to reliably trigger this
WARNING during mount.

Fix this by rejecting rlog_pages values that exceed MAX_ORDER_NR_PAGES
at parse time, returning -EINVAL for out-of-range values.

Reported-by: syzbot+75ff1aecfbeeefb78736@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=75ff1aecfbeeefb78736
Signed-off-by: Tamil Mathi <9tamilmathi@gmail.com>
---
 fs/incfs/vfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/incfs/vfs.c b/fs/incfs/vfs.c
index b45533b..4eaf890 100644
--- a/fs/incfs/vfs.c
+++ b/fs/incfs/vfs.c
@@ -270,6 +270,8 @@ static int parse_options(struct mount_options *opts, char *str)
 		case Opt_rlog_pages:
 			if (match_int(&args[0], &value))
 				return -EINVAL;
+			if (value < 0 || value > MAX_ORDER_NR_PAGES)
+				return -EINVAL;
 			opts->read_log_pages = value;
 			break;
 		case Opt_rlog_wakeup_cnt:
-- 
2.39.5 (Apple Git-154)


                 reply	other threads:[~2026-04-24  4:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260424045954.3187-1-9tamilmathi@gmail.com \
    --to=9tamilmathi@gmail.com \
    --cc=kernel-team@android.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=paullawrence@google.com \
    --cc=syzbot+75ff1aecfbeeefb78736@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