Skip to contentSkip to conversation

atm: clip: prevent NULL deref in clip_push()

PATCH Applied Eric Dumazet 3 participants 3 messages Jun 20, 2025 – Jun 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm: clip: prevent NULL deref in clip_push()

Blamed commit missed that vcc_destroy_socket() calls clip_push() with a NULL skb.

If clip_devs is NULL, clip_push() then crashes when reading skb->truesize.

Fixes 93a2014afbac ("atm: fix a UAF in lec_arp_clear_vccs()")
Reported-by [email protected]
Cc Cong Wang <[email protected]>
Cc Gengming Liu <[email protected]>
---
 net/atm/clip.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
net/atm/clip.c +5 -6
index 61b5b700817de541d2882fb21f07992648460d4a..b234dc3bcb0d4aea0febff50d1b023cb7ad9dfe8 100644
@@ -193,12 +193,6 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
 
 	pr_debug("\n");
 
-	if (!clip_devs) {
-		atm_return(vcc, skb->truesize);
-		kfree_skb(skb);
-		return;
-	}
-
 	if (!skb) {
 		pr_debug("removing VCC %p\n", clip_vcc);
 		if (clip_vcc->entry)
@@ -208,6 +202,11 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
 		return;
 	}
 	atm_return(vcc, skb->truesize);
+	if (!clip_devs) {
+		kfree_skb(skb);
+		return;
+	}
+
 	skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs;
 	/* clip_vcc->entry == NULL if we don't have an IP address yet */
 	if (!skb->dev) {
Signature · 1 line
2.50.0.rc2.701.gf1e915cc24-goog
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eric Dumazet

Blamed commit missed that vcc_destroy_socket() calls clip_push() with a NULL skb.

If clip_devs is NULL, clip_push() then crashes when reading skb->truesize.

Quoted 6 lines
Fixes 93a2014afbac ("atm: fix a UAF in lec_arp_clear_vccs()")
Reported-by [email protected]
Cc Cong Wang <[email protected]>
Cc Gengming Liu <[email protected]>
#2 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 6 lines · On Fri, 20 Jun 2025 14:28:44 +0000 you wrote:

Blamed commit missed that vcc_destroy_socket() calls clip_push() with a NULL skb.

If clip_devs is NULL, clip_push() then crashes when reading skb->truesize.

Quoted 8 lines
Fixes 93a2014afbac ("atm: fix a UAF in lec_arp_clear_vccs()")
Reported-by [email protected]
Cc Cong Wang <[email protected]>
Cc Gengming Liu <[email protected]>

[...]

Here is the summary with links:
- [net] atm: clip: prevent NULL deref in clip_push()

    https://git.kernel.org/netdev/net/c/b993ea46b3b6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html