]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tun: allow positive return values on dev_get_valid_name() call
authorJulien Gomes <julien@arista.com>
Wed, 25 Oct 2017 18:50:50 +0000 (11:50 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Nov 2017 10:06:31 +0000 (11:06 +0100)
commit0e14c46808100ab64d3c935de776afb0ed7f0550
tree81018460855694d8d5a852e3f90ee32ade1f2898
parent5c39875a93d64fc2a3581b93e1db77dc25ca67b0
tun: allow positive return values on dev_get_valid_name() call

[ Upstream commit 5c25f65fd1e42685f7ccd80e0621829c105785d9 ]

If the name argument of dev_get_valid_name() contains "%d", it will try
to assign it a unit number in __dev__alloc_name() and return either the
unit number (>= 0) or an error code (< 0).
Considering positive values as error values prevent tun device creations
relying this mechanism, therefor we should only consider negative values
as errors here.

Signed-off-by: Julien Gomes <julien@arista.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/tun.c