]> www.infradead.org Git - users/jedix/linux-maple.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)
committerBrian Maly <brian.maly@oracle.com>
Wed, 14 Aug 2019 19:49:05 +0000 (15:49 -0400)
commit2ad9d506b3da3c62063af99a7bc07d78a2825c83
treebe51bf2b3e28654132d09ed2e52b202b52e1b405
parent22bae2de78f6ead99febf663e1540e435ef39107
tun: allow positive return values on dev_get_valid_name() call

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>
Orabug: 30085611

(cherry picked from commit 5c25f65fd1e42685f7ccd80e0621829c105785d9)
Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
Reviewed-by: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/tun.c