staging: wfx: fix possible panic with re-queued frames
When the firmware rejects a frame (because station become asleep or disconnected), the frame is re-queued in mac80211. However, the re-queued frame was 8 bytes longer than the original one (the size of the ICV for the encryption). So, when mac80211 try to send this frame again, it is a little bigger than expected. If the frame is re-queued secveral time it end with a skb_over_panic because the skb buffer is not large enough. Note it only happens when device acts as an AP and encryption is enabled. This patch more or less reverts the commit049fde1304
("staging: wfx: drop useless field from struct wfx_tx_priv"). Fixes:049fde1304
("staging: wfx: drop useless field from struct wfx_tx_priv") Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20210208135254.399964-1-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
dc72a882b2
Коммит
26df933d9b
|
@ -331,6 +331,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
|
|||
{
|
||||
struct hif_msg *hif_msg;
|
||||
struct hif_req_tx *req;
|
||||
struct wfx_tx_priv *tx_priv;
|
||||
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
|
||||
struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
|
||||
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
|
||||
|
@ -344,11 +345,14 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
|
|||
|
||||
// From now tx_info->control is unusable
|
||||
memset(tx_info->rate_driver_data, 0, sizeof(struct wfx_tx_priv));
|
||||
// Fill tx_priv
|
||||
tx_priv = (struct wfx_tx_priv *)tx_info->rate_driver_data;
|
||||
tx_priv->icv_size = wfx_tx_get_icv_len(hw_key);
|
||||
|
||||
// Fill hif_msg
|
||||
WARN(skb_headroom(skb) < wmsg_len, "not enough space in skb");
|
||||
WARN(offset & 1, "attempt to transmit an unaligned frame");
|
||||
skb_put(skb, wfx_tx_get_icv_len(hw_key));
|
||||
skb_put(skb, tx_priv->icv_size);
|
||||
skb_push(skb, wmsg_len);
|
||||
memset(skb->data, 0, wmsg_len);
|
||||
hif_msg = (struct hif_msg *)skb->data;
|
||||
|
@ -484,6 +488,7 @@ static void wfx_tx_fill_rates(struct wfx_dev *wdev,
|
|||
|
||||
void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg)
|
||||
{
|
||||
const struct wfx_tx_priv *tx_priv;
|
||||
struct ieee80211_tx_info *tx_info;
|
||||
struct wfx_vif *wvif;
|
||||
struct sk_buff *skb;
|
||||
|
@ -495,6 +500,7 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg)
|
|||
return;
|
||||
}
|
||||
tx_info = IEEE80211_SKB_CB(skb);
|
||||
tx_priv = wfx_skb_tx_priv(skb);
|
||||
wvif = wdev_to_wvif(wdev, ((struct hif_msg *)skb->data)->interface);
|
||||
WARN_ON(!wvif);
|
||||
if (!wvif)
|
||||
|
@ -503,6 +509,8 @@ void wfx_tx_confirm_cb(struct wfx_dev *wdev, const struct hif_cnf_tx *arg)
|
|||
// Note that wfx_pending_get_pkt_us_delay() get data from tx_info
|
||||
_trace_tx_stats(arg, skb, wfx_pending_get_pkt_us_delay(wdev, skb));
|
||||
wfx_tx_fill_rates(wdev, tx_info, arg);
|
||||
skb_trim(skb, skb->len - tx_priv->icv_size);
|
||||
|
||||
// From now, you can touch to tx_info->status, but do not touch to
|
||||
// tx_priv anymore
|
||||
// FIXME: use ieee80211_tx_info_clear_status()
|
||||
|
|
|
@ -35,6 +35,7 @@ struct tx_policy_cache {
|
|||
|
||||
struct wfx_tx_priv {
|
||||
ktime_t xmit_timestamp;
|
||||
unsigned char icv_size;
|
||||
};
|
||||
|
||||
void wfx_tx_policy_init(struct wfx_vif *wvif);
|
||||
|
|
Загрузка…
Ссылка в новой задаче