diff options
| author | Johannes Berg <johannes.berg@intel.com> | 2018-05-18 05:40:44 -0400 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2018-05-18 06:37:55 -0400 |
| commit | 7ea3e110f2f8ba23f330c2f702f556acd539bcb8 (patch) | |
| tree | 8619eac094435ad790ee411991a3a4bd8f69f5b4 /net/wireless | |
| parent | 0fdf1493b41eb64fc7e8c8e1b8830a4bd8c4bbca (diff) | |
cfg80211: release station info tidstats where needed
This fixes memory leaks in cases where we got the station
info but failed sending it out properly.
Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info")
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
| -rw-r--r-- | net/wireless/nl80211.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7daceb1f253d..e4a52a2b5e65 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -4702,7 +4702,6 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, | |||
| 4702 | } | 4702 | } |
| 4703 | 4703 | ||
| 4704 | nla_nest_end(msg, tidsattr); | 4704 | nla_nest_end(msg, tidsattr); |
| 4705 | kfree(sinfo->pertid); | ||
| 4706 | } | 4705 | } |
| 4707 | 4706 | ||
| 4708 | nla_nest_end(msg, sinfoattr); | 4707 | nla_nest_end(msg, sinfoattr); |
| @@ -4712,10 +4711,12 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, | |||
| 4712 | sinfo->assoc_req_ies)) | 4711 | sinfo->assoc_req_ies)) |
| 4713 | goto nla_put_failure; | 4712 | goto nla_put_failure; |
| 4714 | 4713 | ||
| 4714 | cfg80211_sinfo_release_content(sinfo); | ||
| 4715 | genlmsg_end(msg, hdr); | 4715 | genlmsg_end(msg, hdr); |
| 4716 | return 0; | 4716 | return 0; |
| 4717 | 4717 | ||
| 4718 | nla_put_failure: | 4718 | nla_put_failure: |
| 4719 | cfg80211_sinfo_release_content(sinfo); | ||
| 4719 | genlmsg_cancel(msg, hdr); | 4720 | genlmsg_cancel(msg, hdr); |
| 4720 | return -EMSGSIZE; | 4721 | return -EMSGSIZE; |
| 4721 | } | 4722 | } |
| @@ -4797,8 +4798,10 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) | |||
| 4797 | return err; | 4798 | return err; |
| 4798 | 4799 | ||
| 4799 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | 4800 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |
| 4800 | if (!msg) | 4801 | if (!msg) { |
| 4802 | cfg80211_sinfo_release_content(sinfo); | ||
| 4801 | return -ENOMEM; | 4803 | return -ENOMEM; |
| 4804 | } | ||
| 4802 | 4805 | ||
| 4803 | if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION, | 4806 | if (nl80211_send_station(msg, NL80211_CMD_NEW_STATION, |
| 4804 | info->snd_portid, info->snd_seq, 0, | 4807 | info->snd_portid, info->snd_seq, 0, |
| @@ -14624,8 +14627,10 @@ void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr, | |||
| 14624 | trace_cfg80211_del_sta(dev, mac_addr); | 14627 | trace_cfg80211_del_sta(dev, mac_addr); |
| 14625 | 14628 | ||
| 14626 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); | 14629 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); |
| 14627 | if (!msg) | 14630 | if (!msg) { |
| 14631 | cfg80211_sinfo_release_content(sinfo); | ||
| 14628 | return; | 14632 | return; |
| 14633 | } | ||
| 14629 | 14634 | ||
| 14630 | if (nl80211_send_station(msg, NL80211_CMD_DEL_STATION, 0, 0, 0, | 14635 | if (nl80211_send_station(msg, NL80211_CMD_DEL_STATION, 0, 0, 0, |
| 14631 | rdev, dev, mac_addr, sinfo) < 0) { | 14636 | rdev, dev, mac_addr, sinfo) < 0) { |
