diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 07ed21d64f92..0e0ba36eeac9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1106,7 +1106,7 @@ static int __dev_alloc_name(struct net *net, const char *name, char *buf) | |||
1106 | * when the name is long and there isn't enough space left | 1106 | * when the name is long and there isn't enough space left |
1107 | * for the digits, or if all bits are used. | 1107 | * for the digits, or if all bits are used. |
1108 | */ | 1108 | */ |
1109 | return p ? -ENFILE : -EEXIST; | 1109 | return -ENFILE; |
1110 | } | 1110 | } |
1111 | 1111 | ||
1112 | static int dev_alloc_name_ns(struct net *net, | 1112 | static int dev_alloc_name_ns(struct net *net, |
@@ -1146,7 +1146,19 @@ EXPORT_SYMBOL(dev_alloc_name); | |||
1146 | int dev_get_valid_name(struct net *net, struct net_device *dev, | 1146 | int dev_get_valid_name(struct net *net, struct net_device *dev, |
1147 | const char *name) | 1147 | const char *name) |
1148 | { | 1148 | { |
1149 | return dev_alloc_name_ns(net, dev, name); | 1149 | BUG_ON(!net); |
1150 | |||
1151 | if (!dev_valid_name(name)) | ||
1152 | return -EINVAL; | ||
1153 | |||
1154 | if (strchr(name, '%')) | ||
1155 | return dev_alloc_name_ns(net, dev, name); | ||
1156 | else if (__dev_get_by_name(net, name)) | ||
1157 | return -EEXIST; | ||
1158 | else if (dev->name != name) | ||
1159 | strlcpy(dev->name, name, IFNAMSIZ); | ||
1160 | |||
1161 | return 0; | ||
1150 | } | 1162 | } |
1151 | EXPORT_SYMBOL(dev_get_valid_name); | 1163 | EXPORT_SYMBOL(dev_get_valid_name); |
1152 | 1164 | ||
@@ -3904,7 +3916,7 @@ static u32 netif_receive_generic_xdp(struct sk_buff *skb, | |||
3904 | hroom > 0 ? ALIGN(hroom, NET_SKB_PAD) : 0, | 3916 | hroom > 0 ? ALIGN(hroom, NET_SKB_PAD) : 0, |
3905 | troom > 0 ? troom + 128 : 0, GFP_ATOMIC)) | 3917 | troom > 0 ? troom + 128 : 0, GFP_ATOMIC)) |
3906 | goto do_drop; | 3918 | goto do_drop; |
3907 | if (troom > 0 && __skb_linearize(skb)) | 3919 | if (skb_linearize(skb)) |
3908 | goto do_drop; | 3920 | goto do_drop; |
3909 | } | 3921 | } |
3910 | 3922 | ||