public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Vasiliy Kovalev <kovalev@altlinux.org>
To: stable@vger.kernel.org
Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Stefan Richter <stefanr@s5r6.in-berlin.de>,
	lvc-project@linuxtesting.org, kovalev@altlinux.org
Subject: [PATCH 5.10.y] firewire: net: fix use after free in fwnet_finish_incoming_packet()
Date: Wed, 22 Oct 2025 22:27:41 +0300	[thread overview]
Message-ID: <20251022192741.212975-1-kovalev@altlinux.org> (raw)

From: Zhang Shurong <zhang_shurong@foxmail.com>

commit 3ff256751a2853e1ffaa36958ff933ccc98c6cb5 upstream.

The netif_rx() function frees the skb so we can't dereference it to
save the skb->len.

Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
Link: https://lore.kernel.org/r/tencent_3B3D24B66ED66A6BB73CC0E63C6A14E45109@qq.com
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
[ kovalev: bp to fix CVE-2023-53432 ]
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
---
 drivers/firewire/net.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index 715e491dfbc3..8504e95ede90 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -489,7 +489,7 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
 					bool is_broadcast, u16 ether_type)
 {
 	struct fwnet_device *dev;
-	int status;
+	int status, len;
 	__be64 guid;
 
 	switch (ether_type) {
@@ -546,13 +546,15 @@ static int fwnet_finish_incoming_packet(struct net_device *net,
 		}
 		skb->protocol = protocol;
 	}
+
+	len = skb->len;
 	status = netif_rx(skb);
 	if (status == NET_RX_DROP) {
 		net->stats.rx_errors++;
 		net->stats.rx_dropped++;
 	} else {
 		net->stats.rx_packets++;
-		net->stats.rx_bytes += skb->len;
+		net->stats.rx_bytes += len;
 	}
 
 	return 0;
-- 
2.50.1


                 reply	other threads:[~2025-10-22 19:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251022192741.212975-1-kovalev@altlinux.org \
    --to=kovalev@altlinux.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=stable@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /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