diff options
author | Jiri Pirko <jpirko@redhat.com> | 2009-05-08 09:30:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-09 16:15:48 -0400 |
commit | ab9c73ccb52f40576ce017528d542eda3c6ae766 (patch) | |
tree | 23ec53ffc6b55ecb9d06ee605887f5f53b73835e | |
parent | 9948bb6a6db6ad6a8bf2ccaaceb780404f1f43df (diff) |
net: check retval of dev_addr_init()
Add missed checking of dev_addr_init return value in alloc_netdev_mq.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
net/core/dev.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/dev.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 637ea71b0a0d..14dd725aaab7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -5007,13 +5007,16 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, | |||
5007 | if (!tx) { | 5007 | if (!tx) { |
5008 | printk(KERN_ERR "alloc_netdev: Unable to allocate " | 5008 | printk(KERN_ERR "alloc_netdev: Unable to allocate " |
5009 | "tx qdiscs.\n"); | 5009 | "tx qdiscs.\n"); |
5010 | kfree(p); | 5010 | goto free_p; |
5011 | return NULL; | ||
5012 | } | 5011 | } |
5013 | 5012 | ||
5014 | dev = (struct net_device *) | 5013 | dev = (struct net_device *) |
5015 | (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); | 5014 | (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); |
5016 | dev->padded = (char *)dev - (char *)p; | 5015 | dev->padded = (char *)dev - (char *)p; |
5016 | |||
5017 | if (dev_addr_init(dev)) | ||
5018 | goto free_tx; | ||
5019 | |||
5017 | dev_net_set(dev, &init_net); | 5020 | dev_net_set(dev, &init_net); |
5018 | 5021 | ||
5019 | dev->_tx = tx; | 5022 | dev->_tx = tx; |
@@ -5022,13 +5025,19 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, | |||
5022 | 5025 | ||
5023 | dev->gso_max_size = GSO_MAX_SIZE; | 5026 | dev->gso_max_size = GSO_MAX_SIZE; |
5024 | 5027 | ||
5025 | dev_addr_init(dev); | ||
5026 | netdev_init_queues(dev); | 5028 | netdev_init_queues(dev); |
5027 | 5029 | ||
5028 | INIT_LIST_HEAD(&dev->napi_list); | 5030 | INIT_LIST_HEAD(&dev->napi_list); |
5029 | setup(dev); | 5031 | setup(dev); |
5030 | strcpy(dev->name, name); | 5032 | strcpy(dev->name, name); |
5031 | return dev; | 5033 | return dev; |
5034 | |||
5035 | free_tx: | ||
5036 | kfree(tx); | ||
5037 | |||
5038 | free_p: | ||
5039 | kfree(p); | ||
5040 | return NULL; | ||
5032 | } | 5041 | } |
5033 | EXPORT_SYMBOL(alloc_netdev_mq); | 5042 | EXPORT_SYMBOL(alloc_netdev_mq); |
5034 | 5043 | ||