* Re: [PATCH net v4] netrom: linearize and validate lengths in nr_rx_frame()
[not found] <FDBA9F48-A844-4E65-A8B1-6FB660754342@gmail.com>
@ 2025-09-07 21:33 ` Jiri Kosina
2025-09-09 0:43 ` Jakub Kicinski
1 sibling, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2025-09-07 21:33 UTC (permalink / raw)
To: Bernard Pidoux
Cc: stanislav.fort, davem, disclosure, edumazet, horms, kuba,
linux-hams, linux-kernel, netdev, pabeni, security, stable
On Sun, 7 Sep 2025, Bernard Pidoux wrote:
> While applying netrom PATCH net v4
> patch says that
> it is malformed on line 12.
>
> However I cannot see any reason.
There is a superfluous leading space on each line of the diff. (wasn't the
case with the previous patches, v4 is the first one to have this).
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net v4] netrom: linearize and validate lengths in nr_rx_frame()
[not found] <FDBA9F48-A844-4E65-A8B1-6FB660754342@gmail.com>
2025-09-07 21:33 ` [PATCH net v4] netrom: linearize and validate lengths in nr_rx_frame() Jiri Kosina
@ 2025-09-09 0:43 ` Jakub Kicinski
2025-09-09 12:33 ` Bernard f6bvp
1 sibling, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2025-09-09 0:43 UTC (permalink / raw)
To: Bernard Pidoux
Cc: stanislav.fort, davem, disclosure, edumazet, horms, linux-hams,
linux-kernel, netdev, pabeni, security, stable
On Sun, 7 Sep 2025 16:32:03 +0200 Bernard Pidoux wrote:
> While applying netrom PATCH net v4
> patch says that
> it is malformed on line 12.
FWIW the version I received is completely mangled. There's a leading
space before each +. You can try B4 relay if your mail server is giving
you grief.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net v4] netrom: linearize and validate lengths in nr_rx_frame()
2025-09-09 0:43 ` Jakub Kicinski
@ 2025-09-09 12:33 ` Bernard f6bvp
0 siblings, 0 replies; 4+ messages in thread
From: Bernard f6bvp @ 2025-09-09 12:33 UTC (permalink / raw)
To: Jakub Kicinski
Cc: stanislav.fort, davem, disclosure, edumazet, horms, linux-hams,
linux-kernel, netdev, pabeni, security, stable
[-- Attachment #1: Type: text/plain, Size: 528 bytes --]
Hi,
There was also an additional tab in line 14...
Here is well formated patch I applied after fixing it for my own use.
NetRom is performing fine.
Thanks,
Bernard
Le 09/09/2025 à 02:43, Jakub Kicinski a écrit :
> On Sun, 7 Sep 2025 16:32:03 +0200 Bernard Pidoux wrote:
>> While applying netrom PATCH net v4
>> patch says that
>> it is malformed on line 12.
>
> FWIW the version I received is completely mangled. There's a leading
> space before each +. You can try B4 relay if your mail server is giving
> you grief.
[-- Attachment #2: NetRom_patch_09-25_malformed.patch --]
[-- Type: text/plain, Size: 1299 bytes --]
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 3331669..f0660dd 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -885,6 +885,11 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
* skb->data points to the netrom frame start
*/
+ if (skb_linearize(skb))
+ return 0;
+ if (skb->len < NR_NETWORK_LEN + NR_TRANSPORT_LEN)
+ return 0;
+
src = (ax25_address *)(skb->data + 0);
dest = (ax25_address *)(skb->data + 7);
@@ -927,6 +932,11 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
}
if (sk != NULL) {
+ if (frametype == NR_CONNACK &&
+ skb->len < NR_NETWORK_LEN + NR_TRANSPORT_LEN + 1) {
+ sock_put(sk);
+ return 0;
+ }
bh_lock_sock(sk);
skb_reset_transport_header(skb);
@@ -961,10 +971,14 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
return 0;
}
- sk = nr_find_listener(dest);
+ /* Need window (byte 20) and user address (bytes 21-27) */
+ if (skb->len < NR_NETWORK_LEN + NR_TRANSPORT_LEN + 1 + AX25_ADDR_LEN)
+ return 0;
user = (ax25_address *)(skb->data + 21);
+ sk = nr_find_listener(dest);
+
if (sk == NULL || sk_acceptq_is_full(sk) ||
(make = nr_make_new(sk)) == NULL) {
nr_transmit_refusal(skb, 0);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net v4] netrom: linearize and validate lengths in nr_rx_frame()
@ 2025-09-06 1:20 Stanislav Fort
0 siblings, 0 replies; 4+ messages in thread
From: Stanislav Fort @ 2025-09-06 1:20 UTC (permalink / raw)
To: netdev
Cc: davem, edumazet, kuba, pabeni, horms, linux-hams, linux-kernel,
security, Stanislav Fort, stable
Linearize skb and add targeted length checks in nr_rx_frame() to
prevent out-of-bounds reads and potential use-after-free (UAF) when
processing malformed NET/ROM frames.
- Require skb to be linear and at least NR_NETWORK_LEN +
NR_TRANSPORT_LEN (20 bytes) before reading
network/transport fields.
- For existing sockets path, ensure NR_CONNACK includes the window
byte (>= 21 bytes).
- For CONNREQ handling, ensure window (byte 20) and user address
(bytes 21-27) are present (>= 28 bytes).
- Preserve existing BPQ extension handling:
- NR_CONNACK len == 22 -> 1 extra byte (TTL)
- NR_CONNREQ len == 37 -> 2 extra bytes (timeout)
These validations block malformed frames from triggering bounds
violations via short skbs. Because NET/ROM frames may originate from
remote peers, the issue is externally triggerable and therefore
security-relevant.
Suggested-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Stanislav Fort <disclosure@aisle.com>
---
Changes since v3:
- Wrap commit message at 74 columns
- Add Fixes tag and Cc: stable
- Drop Reported-by
- Add Reviewed-by from Eric Dumazet
---
net/netrom/af_netrom.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 3331669d8e33..f0660dd6d3b0 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -885,6 +885,11 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
/*
* skb->data points to the netrom frame start
*/
+ if (skb_linearize(skb))
+ return 0;
+ if (skb->len < NR_NETWORK_LEN + NR_TRANSPORT_LEN)
+ return 0;
+
src = (ax25_address *)(skb->data + 0);
dest = (ax25_address *)(skb->data + 7);
@@ -927,6 +932,11 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
}
if (sk != NULL) {
+ if (frametype == NR_CONNACK &&
+ skb->len < NR_NETWORK_LEN + NR_TRANSPORT_LEN + 1) {
+ sock_put(sk);
+ return 0;
+ }
bh_lock_sock(sk);
skb_reset_transport_header(skb);
@@ -961,10 +971,14 @@ int nr_rx_frame(struct sk_buff *skb, struct net_device *dev)
return 0;
}
- sk = nr_find_listener(dest);
+ /* Need window (byte 20) and user address (bytes 21-27) */
+ if (skb->len < NR_NETWORK_LEN + NR_TRANSPORT_LEN + 1 + AX25_ADDR_LEN)
+ return 0;
user = (ax25_address *)(skb->data + 21);
+ sk = nr_find_listener(dest);
+
if (sk == NULL || sk_acceptq_is_full(sk) ||
(make = nr_make_new(sk)) == NULL) {
nr_transmit_refusal(skb, 0);
--
2.39.3 (Apple Git-146)
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-09 12:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <FDBA9F48-A844-4E65-A8B1-6FB660754342@gmail.com>
2025-09-07 21:33 ` [PATCH net v4] netrom: linearize and validate lengths in nr_rx_frame() Jiri Kosina
2025-09-09 0:43 ` Jakub Kicinski
2025-09-09 12:33 ` Bernard f6bvp
2025-09-06 1:20 Stanislav Fort
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).