1 From foo@baz Thu Nov 16 15:48:06 CET 2017
2 From: Julien Gomes <julien@arista.com>
3 Date: Wed, 25 Oct 2017 11:50:50 -0700
4 Subject: tun: allow positive return values on dev_get_valid_name() call
6 From: Julien Gomes <julien@arista.com>
9 [ Upstream commit 5c25f65fd1e42685f7ccd80e0621829c105785d9 ]
11 If the name argument of dev_get_valid_name() contains "%d", it will try
12 to assign it a unit number in __dev__alloc_name() and return either the
13 unit number (>= 0) or an error code (< 0).
14 Considering positive values as error values prevent tun device creations
15 relying this mechanism, therefor we should only consider negative values
18 Signed-off-by: Julien Gomes <julien@arista.com>
19 Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 drivers/net/tun.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
26 --- a/drivers/net/tun.c
27 +++ b/drivers/net/tun.c
28 @@ -1657,7 +1657,7 @@ static int tun_set_iff(struct net *net,
31 err = dev_get_valid_name(net, dev, name);
36 dev_net_set(dev, net);