diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2013-02-22 01:38:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-22 15:10:19 -0500 |
commit | 2bb60cb9b7b997bdbc7fd6c8001dcca02a4ea2e1 (patch) | |
tree | d84023f594ef132cb3823080bf9a8f6a406b92b6 /net | |
parent | 5b0520425e5ea81ba95ec486dd6bbb59a09fff0e (diff) |
net: Fix locking bug in netif_set_xps_queue
Smatch found a locking bug in netif_set_xps_queue in which we were not
releasing the lock in the case of an allocation failure.
This change corrects that so that we release the xps_map_mutex before
returning -ENOMEM in the case of an allocation failure.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 17bc535115d3..18d8b5acc343 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1882,8 +1882,10 @@ int netif_set_xps_queue(struct net_device *dev, struct cpumask *mask, u16 index) | |||
1882 | 1882 | ||
1883 | if (!new_dev_maps) | 1883 | if (!new_dev_maps) |
1884 | new_dev_maps = kzalloc(maps_sz, GFP_KERNEL); | 1884 | new_dev_maps = kzalloc(maps_sz, GFP_KERNEL); |
1885 | if (!new_dev_maps) | 1885 | if (!new_dev_maps) { |
1886 | mutex_unlock(&xps_map_mutex); | ||
1886 | return -ENOMEM; | 1887 | return -ENOMEM; |
1888 | } | ||
1887 | 1889 | ||
1888 | map = dev_maps ? xmap_dereference(dev_maps->cpu_map[cpu]) : | 1890 | map = dev_maps ? xmap_dereference(dev_maps->cpu_map[cpu]) : |
1889 | NULL; | 1891 | NULL; |