Skip to content
This repository was archived by the owner on Nov 3, 2025. It is now read-only.

Commit 07c37b7

Browse files
edumazetCarlotta-Montelli
authored andcommitted
atm: clip: prevent NULL deref in clip_push()
[ Upstream commit b993ea46b3b601915ceaaf3c802adf11e7d6bac6 ] 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] Closes: https://lore.kernel.org/netdev/[email protected]/T/#u Signed-off-by: Eric Dumazet <[email protected]> Cc: Cong Wang <[email protected]> Cc: Gengming Liu <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 2aaf4e5 commit 07c37b7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

net/atm/clip.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,12 +204,6 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
204204

205205
pr_debug("\n");
206206

207-
if (!clip_devs) {
208-
atm_return(vcc, skb->truesize);
209-
kfree_skb(skb);
210-
return;
211-
}
212-
213207
if (!skb) {
214208
pr_debug("removing VCC %p\n", clip_vcc);
215209
if (clip_vcc->entry)
@@ -219,6 +213,11 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
219213
return;
220214
}
221215
atm_return(vcc, skb->truesize);
216+
if (!clip_devs) {
217+
kfree_skb(skb);
218+
return;
219+
}
220+
222221
skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs;
223222
/* clip_vcc->entry == NULL if we don't have an IP address yet */
224223
if (!skb->dev) {

0 commit comments

Comments
 (0)