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: syzbot+1316233c4c6803382a8b@syzkaller.appspotmail.com Closes: https://lore.kernel.org/netdev/68556f59.a00a0220.137b3.004e.GAE@google.com/T/#u Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Cong Wang <xiyou.wangcong@gmail.com> Cc: Gengming Liu <l.dmxcsnsbh@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 302251f commit b993ea4

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

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)