Netdev List
 help / color / mirror / Atom feed
From: Bernard Pidoux <bernard.f6bvp@gmail.com>
To: ertanuj96@gmail.com
Cc: Greg KH <gregkh@linuxfoundation.org>,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, ralf@linux-mips.org,
	netdev@vger.kernel.org, linux-hams@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] net: rose: fix OOB read in CCITT facility parsing
Date: Wed, 25 Nov 2026 11:41:57 +0100	[thread overview]
Message-ID: <20261125104157.265662-1-bernard.f6bvp@gmail.com> (raw)
In-Reply-To: <2026112418-freebee-tasting-68ba@gregkh>

Hi Tanuj,

Thank you for the fix. I take care of the ROSE code in the out-of-tree
repository Greg mentioned, and I run these modules on a small ROSE/FPAC
network, so here is a review.

The bug is real. rose_parse_ccitt() never checks that the 0xC0 entry
fits in what is left of the facilities field, while
rose_parse_national() does. I reproduced it in user space by building
rose_parse_facilities(), rose_parse_national() and rose_parse_ccitt()
unchanged with AddressSanitizer: a 4-byte facilities field
"00 0F C9 0A" (CCITT, DEST_NSAP, l = 10, the 10 bytes missing) at the
end of the buffer gives a heap-buffer-overflow read in
rose_parse_ccitt() (the memcpy() from p + 7). With your patch the entry
is rejected and AddressSanitizer stays quiet.

Two points in the commit message are not right, though:

- It is not only 6.12 and older. 6.18.y has the same code (checked in
  v6.18.65), and so does the out-of-tree repository.

- The data read past the buffer does not reach user space. When
  rose_parse_ccitt() returns more than it was given,
  rose_parse_facilities() catches it with
  WARN_ON(len >= facilities_len) and returns 0. Both callers,
  rose_rx_call_request() and rose_route_frame(), then clear the call,
  and the facilities struct, a local variable, is dropped. getsockname()
  and getpeername() never see it. The user-space test above goes the
  same way: the WARN_ON fires and the parse fails.

So the effect is an out-of-bounds read of up to about 20 bytes past the
facilities field, and a WARN that any ROSE neighbour can trigger from
the air or over AXUDP with a crafted CALL REQUEST, which means a reboot
on a system with panic_on_warn set. That is still worth fixing, and
your two lines are the right fix.

As Greg said, please open a pull request at

  https://github.com/linux-netdev/mod-orphan

with the commit message updated as above (and the answer to the netdev
bot's question about how the bug was found). Once it is merged there,
it will go to the stable maintainers for 6.12.y and 6.18.y with the
next batch of fixes from that repository. If you would rather not deal
with GitHub, tell me and I will carry it there with you as the author.

Reviewed-by: Bernard Pidoux <bernard.f6bvp@gmail.com>

73 de Bernard, F6BVP

      reply	other threads:[~2026-11-25 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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
2026-11-24  7:05 ` Greg KH
2026-11-25 10:41   ` Bernard Pidoux [this message]

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=20261125104157.265662-1-bernard.f6bvp@gmail.com \
    --to=bernard.f6bvp@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ertanuj96@gmail.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