]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: ip_gre: Accept IFLA_INFO_DATA-less configuration
authorPetr Machata <petrm@mellanox.com>
Mon, 16 Mar 2020 17:53:00 +0000 (19:53 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Mar 2020 00:19:56 +0000 (17:19 -0700)
The fix referenced below causes a crash when an ERSPAN tunnel is created
without passing IFLA_INFO_DATA. Fix by validating passed-in data in the
same way as ipgre does.

Fixes: 0da2860deb19 ("net: ip_gre: Separate ERSPAN newlink / changelink callbacks")
Reported-by: syzbot+1b4ebf4dae4e510dd219@syzkaller.appspotmail.com
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_gre.c

index 7765c65fc7d2197e1a27f7c8199626f4a4bd5f0b..029b24eeafbaf8ec28b0f55ff08de58b8fb0efdd 100644 (file)
@@ -1168,6 +1168,8 @@ static int erspan_netlink_parms(struct net_device *dev,
        err = ipgre_netlink_parms(dev, data, tb, parms, fwmark);
        if (err)
                return err;
+       if (!data)
+               return 0;
 
        if (data[IFLA_GRE_ERSPAN_VER]) {
                t->erspan_ver = nla_get_u8(data[IFLA_GRE_ERSPAN_VER]);