diff options
-rw-r--r-- | net/core/dev.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index e91390533999..a90737fe2472 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -967,6 +967,14 @@ int dev_set_alias(struct net_device *dev, const char *alias, size_t len) | |||
967 | if (len >= IFALIASZ) | 967 | if (len >= IFALIASZ) |
968 | return -EINVAL; | 968 | return -EINVAL; |
969 | 969 | ||
970 | if (!len) { | ||
971 | if (dev->ifalias) { | ||
972 | kfree(dev->ifalias); | ||
973 | dev->ifalias = NULL; | ||
974 | } | ||
975 | return 0; | ||
976 | } | ||
977 | |||
970 | dev->ifalias = krealloc(dev->ifalias, len+1, GFP_KERNEL); | 978 | dev->ifalias = krealloc(dev->ifalias, len+1, GFP_KERNEL); |
971 | if (!dev->ifalias) | 979 | if (!dev->ifalias) |
972 | return -ENOMEM; | 980 | return -ENOMEM; |