bonding: validate ip header before check IPPROTO_IGMP
authorCong Wang <xiyou.wangcong@gmail.com>
Tue, 2 Jul 2019 03:40:24 +0000 (20:40 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 31 Oct 2019 22:15:02 +0000 (22:15 +0000)
commitc78cea757215f10b8285619e408930aff23754df
treebf08f63c438704233c018ab2e70fdb84b6a9d07e
parent95030117c3ff3a5e7b394ff7e1d27b1d97510c0f
bonding: validate ip header before check IPPROTO_IGMP

commit 9d1bc24b52fb8c5d859f9a47084bf1179470e04c upstream.

bond_xmit_roundrobin() checks for IGMP packets but it parses
the IP header even before checking skb->protocol.

We should validate the IP header with pskb_may_pull() before
using iph->protocol.

Reported-and-tested-by: syzbot+e5be16aa39ad6e755391@syzkaller.appspotmail.com
Fixes: a2fd940f4cff ("bonding: fix broken multicast with round-robin mode")
Cc: Jay Vosburgh <j.vosburgh@gmail.com>
Cc: Veaceslav Falico <vfalico@gmail.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.16:
 - Keep using ACCESS_ONCE(), dev_kfree_skb_any(), …_can_tx()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/bonding/bond_main.c