aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-06-11 10:51:03 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-06-11 10:52:39 -0400
commit940d0ac9dbe3fb9d4806e96f006286c2e476deed (patch)
tree3fea9c0940ebc98eb60e1459ed80ae48440d241b /net/wireless
parentea141b75ae29636b5c9e9d2e2e77b3dd1ab4c934 (diff)
cfg80211: fix rtnl leak in wiphy dump error cases
In two wiphy dump error cases, most often when the dump allocation must be increased, the RTNL is leaked. This quickly results in a complete system lockup. Release the RTNL correctly. Reported-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/nl80211.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 398ce2c59686..e4028197b75d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1541,8 +1541,10 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
1541 int ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]); 1541 int ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
1542 1542
1543 netdev = dev_get_by_index(sock_net(skb->sk), ifidx); 1543 netdev = dev_get_by_index(sock_net(skb->sk), ifidx);
1544 if (!netdev) 1544 if (!netdev) {
1545 rtnl_unlock();
1545 return -ENODEV; 1546 return -ENODEV;
1547 }
1546 if (netdev->ieee80211_ptr) { 1548 if (netdev->ieee80211_ptr) {
1547 dev = wiphy_to_dev( 1549 dev = wiphy_to_dev(
1548 netdev->ieee80211_ptr->wiphy); 1550 netdev->ieee80211_ptr->wiphy);
@@ -1586,6 +1588,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
1586 !skb->len && 1588 !skb->len &&
1587 cb->min_dump_alloc < 4096) { 1589 cb->min_dump_alloc < 4096) {
1588 cb->min_dump_alloc = 4096; 1590 cb->min_dump_alloc = 4096;
1591 rtnl_unlock();
1589 return 1; 1592 return 1;
1590 } 1593 }
1591 idx--; 1594 idx--;