From: Hungyu Lin <dennylin0707@gmail.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>, Joel Granados <joel.granados@kernel.org>,
Luca Vizzarro <Luca.Vizzarro@arm.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Hungyu Lin <dennylin0707@gmail.com>
Subject: [PATCH] pipe: reject oversized pipe-max-size sysctl writes
Date: Tue, 20 Oct 2026 15:28:57 +0000 [thread overview]
Message-ID: <20261020152857.48989-1-dennylin0707@gmail.com> (raw)
On 64-bit kernels, the unsigned long sysctl input is truncated before
round_pipe_size() checks it as an unsigned int. Writing 4294967296 to
pipe-max-size therefore succeeds and stores PAGE_SIZE.
Reject values above UINT_MAX before narrowing them, so the sysctl
handler returns EINVAL without changing the stored limit.
Fixes: 515c5046650d ("pipe: Pass argument of pipe_fcntl as int")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
fs/pipe.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/pipe.c b/fs/pipe.c
index 4fa69192e6fb..5472a687ddbb 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1566,6 +1566,9 @@ static struct file_system_type pipe_fs_type = {
static ulong round_pipe_size_ul(ulong size)
{
+ if (size > UINT_MAX)
+ return 0;
+
return round_pipe_size(size);
}
base-commit: f47d223627f80cb7a1eb14c585fe6cb35de5e984
--
2.43.0
reply other threads:[~2026-10-20 15:29 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=20261020152857.48989-1-dennylin0707@gmail.com \
--to=dennylin0707@gmail.com \
--cc=Luca.Vizzarro@arm.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=joel.granados@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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®