From: Tanuj Sharma <ertanuj96@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: gregkh@linuxfoundation.org, netdev@vger.kernel.org,
linux-hams@vger.kernel.org, stable@vger.kernel.org,
ralf@linux-mips.org, horms@kernel.org
Subject: [PATCH] net: rose: fix OOB read in CCITT facility parsing
Date: Tue, 24 Nov 2026 00:08:18 +0530 [thread overview]
Message-ID: <20261123183818.24508-1-ertanuj96@gmail.com> (raw)
In rose_parse_ccitt(), the 0xC0 (variable-length) case validates that
len >= 2 and that the length field l is in range [10, 20], but does not
check that the remaining buffer can actually hold l + 2 bytes before
performing memcpy operations at offsets p+7 and p+12.
With a short facilities field (e.g. 2 bytes) and l=10, the memcpy calls
read up to 15 bytes past the buffer, leaking adjacent heap data into
the facilities struct. This data is then copied to the socket and can be
read by userspace via getsockname()/getpeername().
Add the same bounds check that rose_parse_national() already uses for
its own 0xC0 case: if (len < 2 + l) return -1.
This code was removed from mainline by commit dd8d4bc28ad72 but remains
in the 6.12 LTS branch and all prior LTS branches.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Tanuj Sharma <ertanuj96@gmail.com>
---
net/rose/rose_subr.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/rose/rose_subr.c b/net/rose/rose_subr.c
index XXXXXXX..XXXXXXX 100644
--- a/net/rose/rose_subr.c
+++ b/net/rose/rose_subr.c
@@ -369,6 +369,8 @@ static int rose_parse_ccitt(unsigned char *p,
/* Prevent overflows*/
if (l < 10 || l > 20)
return -1;
+ if (len < 2 + l)
+ return -1;
if (*p == FAC_CCITT_DEST_NSAP) {
memcpy(&facilities->source_addr, p + 7, ROSE_ADDR_LEN);
--
2.43.0
next reply other threads:[~2026-11-23 18:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 18:38 Tanuj Sharma [this message]
2026-11-23 18:43 ` [PATCH] net: rose: fix OOB read in CCITT facility parsing netdev-bot+sinfo
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=20261123183818.24508-1-ertanuj96@gmail.com \
--to=ertanuj96@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-hams@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ralf@linux-mips.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox