Skip to contentSkip to conversation

cfg80211: fix a crash in dev lookup on dump commands

PATCH In review Felix Fietkau 2 participants 2 messages Oct 31, 2010 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfg80211: fix a crash in dev lookup on dump commands

IS_ERR and PTR_ERR were called with the wrong pointer, leading to a crash when cfg80211_get_dev_from_ifindex fails.

---

net/wireless/nl80211.c +2 -2
@@ -224,8 +224,8 @@ static int nl80211_prepare_netdev_dump(s
 	}
 
 	*rdev = cfg80211_get_dev_from_ifindex(sock_net(skb->sk), ifidx);
-	if (IS_ERR(dev)) {
-		err = PTR_ERR(dev);
+	if (IS_ERR(*rdev)) {
+		err = PTR_ERR(*rdev);
 		goto out_rtnl;
 	}
 
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Felix Fietkau

IS_ERR and PTR_ERR were called with the wrong pointer, leading to a crash when cfg80211_get_dev_from_ifindex fails.

Good catch, thanks.

johannes