From: Serhey Popovych Date: Tue, 9 Oct 2018 18:21:01 +0000 (+0300) Subject: tun: Consistently configure generic netdev params via rtnetlink X-Git-Tag: v4.9.137~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f008fce1f275c851f62a3bf2238d5f4fc27d4dc;p=platform%2Fkernel%2Flinux-amlogic.git tun: Consistently configure generic netdev params via rtnetlink [ Upstream commit df52eab23d703142c766ac00bdb8db19d71238d0 ] Configuring generic network device parameters on tun will fail in presence of IFLA_INFO_KIND attribute in IFLA_LINKINFO nested attribute since tun_validate() always return failure. This can be visualized with following ip-link(8) command sequences: # ip link set dev tun0 group 100 # ip link set dev tun0 group 100 type tun RTNETLINK answers: Invalid argument with contrast to dummy and veth drivers: # ip link set dev dummy0 group 100 # ip link set dev dummy0 type dummy # ip link set dev veth0 group 100 # ip link set dev veth0 group 100 type veth Fix by returning zero in tun_validate() when @data is NULL that is always in case since rtnl_link_ops->maxtype is zero in tun driver. Fixes: f019a7a594d9 ("tun: Implement ip link del tunXXX") Signed-off-by: Serhey Popovych Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/tun.c b/drivers/net/tun.c index eb6dc28e5e52..0260bc15bc0c 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1570,6 +1570,8 @@ static void tun_setup(struct net_device *dev) */ static int tun_validate(struct nlattr *tb[], struct nlattr *data[]) { + if (!data) + return 0; return -EINVAL; }