Skip to content

Commit b993ea4

Browse files
edumazetdavem330
authored andcommitted
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: 93a2014 ("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]>
1 parent 302251f commit b993ea4

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
@@ -193,12 +193,6 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
193193

194194
pr_debug("\n");
195195

196-
if (!clip_devs) {
197-
atm_return(vcc, skb->truesize);
198-
kfree_skb(skb);
199-
return;
200-
}
201-
202196
if (!skb) {
203197
pr_debug("removing VCC %p\n", clip_vcc);
204198
if (clip_vcc->entry)
@@ -208,6 +202,11 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
208202
return;
209203
}
210204
atm_return(vcc, skb->truesize);
205+
if (!clip_devs) {
206+
kfree_skb(skb);
207+
return;
208+
}
209+
211210
skb->dev = clip_vcc->entry ? clip_vcc->entry->neigh->dev : clip_devs;
212211
/* clip_vcc->entry == NULL if we don't have an IP address yet */
213212
if (!skb->dev) {

0 commit comments

Comments
 (0)