]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net: core: maybe return -EEXIST in __dev_alloc_name
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Sun, 12 Nov 2017 23:15:09 +0000 (00:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 14 Nov 2017 07:38:46 +0000 (16:38 +0900)
If we're given format string with no %d, -EEXIST is a saner error code.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index cb3d95edf58d29710efb59198ff7c8d9ee886147..1bb856eaed1c42b012eb7aa253c2a301a451cff8 100644 (file)
@@ -1106,7 +1106,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf)
         * when the name is long and there isn't enough space left
         * for the digits, or if all bits are used.
         */
-       return -ENFILE;
+       return p ? -ENFILE : -EEXIST;
 }
 
 static int dev_alloc_name_ns(struct net *net,