Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Bernard f6bvp <bernard.f6bvp@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: stanislav.fort@aisle.com, davem@davemloft.net,
	disclosure@aisle.com, edumazet@google.com, horms@kernel.org,
	linux-hams@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com, security@kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net v4] netrom: linearize and validate lengths in nr_rx_frame()
Date: Tue, 9 Sep 2025 14:33:45 +0200	[thread overview]
Message-ID: <f56f4d49-4175-4863-b523-aae628394e2c@gmail.com> (raw)
In-Reply-To: <20250908174331.47d895a0@kernel.org>

[-- 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);

  reply	other threads:[~2025-09-09 12:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2025-09-06  1:20 Stanislav Fort

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=f56f4d49-4175-4863-b523-aae628394e2c@gmail.com \
    --to=bernard.f6bvp@gmail.com \
    --cc=davem@davemloft.net \
    --cc=disclosure@aisle.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-hams@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=security@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stanislav.fort@aisle.com \
    /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