diff options
author | Bob Copeland <me@bobcopeland.com> | 2015-02-05 14:45:43 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-02-24 10:49:47 +0100 |
commit | f2831e2007810b690f93a26128058a193eadf393 (patch) | |
tree | e434484749d21bc7da4aa1d87ca4587c9c7dbfd0 /drivers/net | |
parent | tcp: fix tcp_should_expand_sndbuf() to use tcp_packets_in_flight() (diff) | |
download | linux-f2831e2007810b690f93a26128058a193eadf393.tar.xz linux-f2831e2007810b690f93a26128058a193eadf393.zip |
mac80211_hwsim: fix error handling in tx_frame_nl
Correct two problems with the error handling when using the netlink
forwarding API: first, the netlink skb is never freed if nla_put()
fails; and second, genlmsg_unicast() can fail if the netlink socket
is full. In the latter case, the corresponding data skb is not counted
as a drop and userspace programs like wmediumd will see TCP stalls
due to lost packets.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 4a4c6586a8d2..8908be6dbc48 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -946,7 +946,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, goto nla_put_failure; genlmsg_end(skb, msg_head); - genlmsg_unicast(&init_net, skb, dst_portid); + if (genlmsg_unicast(&init_net, skb, dst_portid)) + goto err_free_txskb; /* Enqueue the packet */ skb_queue_tail(&data->pending, my_skb); @@ -955,6 +956,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, return; nla_put_failure: + nlmsg_free(skb); +err_free_txskb: printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); ieee80211_free_txskb(hw, my_skb); data->tx_failed++; |