Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: rose: fix OOB read in CCITT facility parsing
@ 2026-11-23 18:38 Tanuj Sharma
  2026-11-23 18:43 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Tanuj Sharma @ 2026-11-23 18:38 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni
  Cc: gregkh, netdev, linux-hams, stable, ralf, horms

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: rose: fix OOB read in CCITT facility parsing
  2026-11-23 18:38 [PATCH] net: rose: fix OOB read in CCITT facility parsing Tanuj Sharma
@ 2026-11-23 18:43 ` netdev-bot+sinfo
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-23 18:43 UTC (permalink / raw)
  To: Tanuj Sharma
  Cc: davem, edumazet, kuba, pabeni, gregkh, netdev, linux-hams, stable,
	ralf, horms

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23 18:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 18:38 [PATCH] net: rose: fix OOB read in CCITT facility parsing Tanuj Sharma
2026-11-23 18:43 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox