iwlwifi: pcie: don't consider IV len in A-MSDU
Subsystems (2)
PATCH 1/3 iwlwifi: pcie: don't consider IV len in A-MSDU
From: Mordechay Goodstein <[email protected]>
From gen2 PN is totally offloaded to hardware (also the space for the IV isn't part of the skb). As you can see in mvm/mac80211.c:3545, the MAC for cipher types CCMP/GCMP doesn't set IEEE80211_KEY_FLAG_PUT_IV_SPACE for gen2 NICs.
This causes all the AMSDU data to be corrupted with cipher enabled.
--- .../net/wireless/intel/iwlwifi/pcie/tx-gen2.c | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c +7 -13
@@ -251,27 +251,23 @@ static int iwl_pcie_gen2_build_amsdu(struct iwl_trans *trans,struct ieee80211_hdr *hdr = (void *)skb->data;unsigned int snap_ip_tcp_hdrlen, ip_hdrlen, total_len, hdr_room;unsigned int mss =skb_shinfo (skb)->gso_size; -u16 length, iv_len, amsdu_pad; +u16 length, amsdu_pad;u8 *start_hdr;struct iwl_tso_hdr_page *hdr_page;struct page **page_ptr;struct tso_t tso; -/* if the packet is protected, then it must be CCMP or GCMP */ - iv_len =ieee80211_has_protected (hdr->frame_control) ? -IEEE80211_CCMP_HDR_LEN :0 ; -trace_iwlwifi_dev_tx (trans->dev, skb, tfd,sizeof (*tfd), &dev_cmd->hdr, start_len,0 ); ip_hdrlen =skb_transport_header (skb) -skb_network_header (skb); snap_ip_tcp_hdrlen =8 + ip_hdrlen +tcp_hdrlen (skb); - total_len = skb->len - snap_ip_tcp_hdrlen - hdr_len - iv_len; + total_len = skb->len - snap_ip_tcp_hdrlen - hdr_len; amsdu_pad =0 ;/* total amount of header we may need for this A-MSDU */ hdr_room =DIV_ROUND_UP (total_len, mss) * - (3 + snap_ip_tcp_hdrlen +sizeof (struct ethhdr )) + iv_len; + (3 + snap_ip_tcp_hdrlen +sizeof (struct ethhdr ));/* Our device supports 9 segments at most, it will fit in 1 page */ hdr_page =get_page_hdr (trans, hdr_room);
@@ -282,14 +278,12 @@ static int iwl_pcie_gen2_build_amsdu(struct iwl_trans *trans, start_hdr = hdr_page->pos; page_ptr = (void *)((u8 *)skb->cb + trans_pcie->page_offs); *page_ptr = hdr_page->page; -memcpy (hdr_page->pos, skb->data + hdr_len, iv_len); - hdr_page->pos += iv_len;/* -* Pull the ieee80211 header + IV to be able to use TSO core, +* Pull the ieee80211 header to be able to use TSO core, * we will restore it for the tx_status flow. */ -skb_pull (skb, hdr_len + iv_len); +skb_pull (skb, hdr_len);/* * Remove the length of all the headers that we don't actually
@@ -364,8 +358,8 @@ static int iwl_pcie_gen2_build_amsdu(struct iwl_trans *trans, } } -/* re -add the WiFi header and IV */ -skb_push (skb, hdr_len + iv_len); +/* re -add the WiFi header */ +skb_push (skb, hdr_len);return 0 ;
Signature · 1 line
2.24.0.rc1
PATCH 2/3 mac80211: fix ieee80211_txq_setup_flows() failure path
From: Johannes Berg <[email protected]>
If ieee80211_txq_setup_flows() fails, we don't clean up WEP/LED state properly, leading to crashes later on, fix that.
--- net/mac80211/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/main.c +1 -1
@@ -1292,8 +1292,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)ieee80211_remove_interfaces (local); fail_rate:rtnl_unlock (); -ieee80211_led_exit (local); fail_flows: +ieee80211_led_exit (local);destroy_workqueue (local->workqueue); fail_workqueue:wiphy_unregister (local->hw.wiphy);
Signature · 1 line
2.24.0.rc1
PATCH 3/3 iwlwifi: check kasprintf() return value
In reply to Luca CoelhoFrom: Johannes Berg <[email protected]>
kasprintf() can fail, we should check the return value.
--- drivers/net/wireless/intel/iwlwifi/dvm/led.c | 3 +++ drivers/net/wireless/intel/iwlwifi/mvm/led.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/dvm/led.c +3 -0
@@ -171,6 +171,9 @@ void iwl_leds_init(struct iwl_priv *priv) priv->led.name =kasprintf (GFP_KERNEL ,"%s-led" ,wiphy_name (priv->hw->wiphy)); +if (!priv->led.name) +return ; + priv->led.brightness_set = iwl_led_brightness_set; priv->led.blink_set = iwl_led_blink_set; priv->led.max_brightness =1 ;
drivers/net/wireless/intel/iwlwifi/mvm/led.c +3 -0
@@ -129,6 +129,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm) mvm->led.name =kasprintf (GFP_KERNEL ,"%s-led" ,wiphy_name (mvm->hw->wiphy)); +if (!mvm->led.name) +return -ENOMEM ; + mvm->led.brightness_set = iwl_led_brightness_set; mvm->led.max_brightness =1 ;
Signature · 1 line
2.24.0.rc1
Re: [PATCH v5.4 3/3] iwlwifi: check kasprintf() return value
Quoted 9 lines · Luca Coelho
From: Johannes Berg <[email protected]>
kasprintf()can fail, we should check the return value.Fixes 5ed540aecc2a ("iwlwifi: use mac80211 throughput trigger")Fixes 8ca151b568b6 ("iwlwifi: add the MVM driver")Signed-off-by Johannes Berg <[email protected]>Signed-off-by Luca Coelho <[email protected]>---
Let's drop this one from v5.4. This is extremely unlikely to fail and the real reason for the crash we have observed was fixed in Johannes' mac80211 patch (2/3 in this series).
--
Luca.
Quoted 11 lines · Luca Coelho
From: Mordechay Goodstein <[email protected]>
From gen2 PN is totally offloaded to hardware (also the space for the IV isn't part of the skb). As you can see in
mvm/mac80211.c:3545, the MAC for cipher types CCMP/GCMP doesn't setIEEE80211_KEY_FLAG_PUT_IV_SPACEfor gen2 NICs.This causes all the AMSDU data to be corrupted with cipher enabled.
Signed-off-by Mordechay Goodstein <[email protected]>Signed-off-by Luca Coelho <[email protected]>
Patch applied to wireless-drivers.git, thanks.
cb1a4badf592 iwlwifi: pcie: don't consider IV len in A-MSDU
Signature · 3 lines
https://patchwork.kernel.org/patch/11232699/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches