@@ -7451,6 +7451,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
7451
7451
struct wireless_dev *wdev;
7452
7452
u8 mac_addr[ETH_ALEN];
7453
7453
int sta_idx = cb->args[2];
7454
+ bool sinfo_alloc = false;
7454
7455
int err, i;
7455
7456
7456
7457
err = nl80211_prepare_wdev_dump(cb, &rdev, &wdev, NULL);
@@ -7479,6 +7480,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
7479
7480
err = -ENOMEM;
7480
7481
goto out_err;
7481
7482
}
7483
+ sinfo_alloc = true;
7482
7484
}
7483
7485
7484
7486
err = rdev_dump_station(rdev, wdev->netdev, sta_idx,
@@ -7491,6 +7493,11 @@ static int nl80211_dump_station(struct sk_buff *skb,
7491
7493
if (sinfo.valid_links)
7492
7494
cfg80211_sta_set_mld_sinfo(&sinfo);
7493
7495
7496
+ /* reset the sinfo_alloc flag as nl80211_send_station()
7497
+ * always releases sinfo
7498
+ */
7499
+ sinfo_alloc = false;
7500
+
7494
7501
if (nl80211_send_station(skb, NL80211_CMD_NEW_STATION,
7495
7502
NETLINK_CB(cb->skb).portid,
7496
7503
cb->nlh->nlmsg_seq, NLM_F_MULTI,
@@ -7505,7 +7512,8 @@ static int nl80211_dump_station(struct sk_buff *skb,
7505
7512
cb->args[2] = sta_idx;
7506
7513
err = skb->len;
7507
7514
out_err:
7508
- cfg80211_sinfo_release_content(&sinfo);
7515
+ if (sinfo_alloc)
7516
+ cfg80211_sinfo_release_content(&sinfo);
7509
7517
wiphy_unlock(&rdev->wiphy);
7510
7518
7511
7519
return err;
0 commit comments