1 |
From 62de8ffe9ad821edfb47543facf758214e5cc697 Mon Sep 17 00:00:00 2001 |
2 |
From: Serhey Popovych <serhe.popovych@gmail.com> |
3 |
Date: Tue, 9 Oct 2018 21:21:01 +0300 |
4 |
Subject: [PATCH 011/145] tun: Consistently configure generic netdev params via |
5 |
rtnetlink |
6 |
|
7 |
[ Upstream commit df52eab23d703142c766ac00bdb8db19d71238d0 ] |
8 |
|
9 |
Configuring generic network device parameters on tun will fail in |
10 |
presence of IFLA_INFO_KIND attribute in IFLA_LINKINFO nested attribute |
11 |
since tun_validate() always return failure. |
12 |
|
13 |
This can be visualized with following ip-link(8) command sequences: |
14 |
|
15 |
# ip link set dev tun0 group 100 |
16 |
# ip link set dev tun0 group 100 type tun |
17 |
RTNETLINK answers: Invalid argument |
18 |
|
19 |
with contrast to dummy and veth drivers: |
20 |
|
21 |
# ip link set dev dummy0 group 100 |
22 |
# ip link set dev dummy0 type dummy |
23 |
|
24 |
# ip link set dev veth0 group 100 |
25 |
# ip link set dev veth0 group 100 type veth |
26 |
|
27 |
Fix by returning zero in tun_validate() when @data is NULL that is |
28 |
always in case since rtnl_link_ops->maxtype is zero in tun driver. |
29 |
|
30 |
Fixes: f019a7a594d9 ("tun: Implement ip link del tunXXX") |
31 |
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com> |
32 |
Signed-off-by: David S. Miller <davem@davemloft.net> |
33 |
Signed-off-by: Sasha Levin <sashal@kernel.org> |
34 |
--- |
35 |
drivers/net/tun.c | 2 ++ |
36 |
1 file changed, 2 insertions(+) |
37 |
|
38 |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c |
39 |
index 50e9cc19023a..c52207beef88 100644 |
40 |
--- a/drivers/net/tun.c |
41 |
+++ b/drivers/net/tun.c |
42 |
@@ -2264,6 +2264,8 @@ static void tun_setup(struct net_device *dev) |
43 |
static int tun_validate(struct nlattr *tb[], struct nlattr *data[], |
44 |
struct netlink_ext_ack *extack) |
45 |
{ |
46 |
+ if (!data) |
47 |
+ return 0; |
48 |
return -EINVAL; |
49 |
} |
50 |
|
51 |
-- |
52 |
2.19.1 |
53 |
|