iwlwifi: mvm: fix a use-after-free bug in iwl_mvm_tx_tso_segment
Accessing the hdr of an skb that was consumed already isn't
a good idea.
First ask if the skb is a QoS packet, then keep that data
on stack, and then consume the skb.
This was spotted by KASAN.
Cc: stable@vger.kernel.org
Fixes: 08f7d8b69a
("iwlwifi: mvm: bring back mvm GSO code")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Родитель
ba3224db78
Коммит
71b256f8f7
|
@ -831,6 +831,7 @@ iwl_mvm_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes,
|
||||||
unsigned int tcp_payload_len;
|
unsigned int tcp_payload_len;
|
||||||
unsigned int mss = skb_shinfo(skb)->gso_size;
|
unsigned int mss = skb_shinfo(skb)->gso_size;
|
||||||
bool ipv4 = (skb->protocol == htons(ETH_P_IP));
|
bool ipv4 = (skb->protocol == htons(ETH_P_IP));
|
||||||
|
bool qos = ieee80211_is_data_qos(hdr->frame_control);
|
||||||
u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0;
|
u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0;
|
||||||
|
|
||||||
skb_shinfo(skb)->gso_size = num_subframes * mss;
|
skb_shinfo(skb)->gso_size = num_subframes * mss;
|
||||||
|
@ -864,7 +865,7 @@ iwl_mvm_tx_tso_segment(struct sk_buff *skb, unsigned int num_subframes,
|
||||||
if (tcp_payload_len > mss) {
|
if (tcp_payload_len > mss) {
|
||||||
skb_shinfo(tmp)->gso_size = mss;
|
skb_shinfo(tmp)->gso_size = mss;
|
||||||
} else {
|
} else {
|
||||||
if (ieee80211_is_data_qos(hdr->frame_control)) {
|
if (qos) {
|
||||||
u8 *qc;
|
u8 *qc;
|
||||||
|
|
||||||
if (ipv4)
|
if (ipv4)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче