Skip to contentSkip to conversation

mac80211: fix queue selection for data frames on monitor interfaces

PATCH Felix Fietkau 3 participants 6 messages Jan 11, 2010 – Jan 12, 2010 mac80211

lore
Share & tools
lore
#0 lore raw

When ieee80211_monitor_select_queue encounters data frames, it selects the WMM AC based on skb->priority and assumes that skb->priority contains a valid 802.1d tag. However this assumption is incorrect, since ieee80211_select_queue has not been called at this point.
If skb->priority > 7, an array overrun occurs, which could lead to invalid values, resulting in crashes in the tx path.
Fix this by setting skb->priority based on the 802.11 header for QoS frames and using the default AC for all non-QoS frames.

---

net/mac80211/iface.c +5 -1
@@ -685,6 +685,7 @@ static u16 ieee80211_monitor_select_queu
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_hdr *hdr;
 	struct ieee80211_radiotap_header *rtap = (void *)skb->data;
+	u8 *p;
 
 	if (local->hw.queues < 4)
 		return 0;
@@ -695,11 +696,14 @@ static u16 ieee80211_monitor_select_queu
 
 	hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len));
 
-	if (!ieee80211_is_data(hdr->frame_control)) {
+	if (!ieee80211_is_data_qos(hdr->frame_control)) {
 		skb->priority = 7;
 		return ieee802_1d_to_ac[skb->priority];
 	}
 
+	p = ieee80211_get_qos_ctl(hdr);
+	skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK;
+
 	return ieee80211_downgrade_queue(local, skb);
 }
 
#1 lore raw
Quoted 10 lines · Felix Fietkau

When ieee80211_monitor_select_queue encounters data frames, it selects the WMM AC based on skb->priority and assumes that skb->priority contains a valid 802.1d tag. However this assumption is incorrect, since ieee80211_select_queue has not been called at this point.
If skb->priority > 7, an array overrun occurs, which could lead to invalid values, resulting in crashes in the tx path.
Fix this by setting skb->priority based on the 802.11 header for QoS frames and using the default AC for all non-QoS frames.

Its unclear whether or not this is a stable fix. It fixes a crash but does this depend on a patch added recently which is not in stable yet?

Luis

#2 lore raw
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Felix Fietkau

When ieee80211_monitor_select_queue encounters data frames, it selects the WMM AC based on skb->priority and assumes that skb->priority contains a valid 802.1d tag. However this assumption is incorrect, since ieee80211_select_queue has not been called at this point.
If skb->priority > 7, an array overrun occurs, which could lead to invalid values, resulting in crashes in the tx path.
Fix this by setting skb->priority based on the 802.11 header for QoS frames and using the default AC for all non-QoS frames.

Quoted 4 lines
Quoted 1 line

Its unclear whether or not this is a stable fix. It fixes a crash but does this depend on a patch added recently which is not in stable yet?

It depends on the pile of tx queue fixes, and the crash doesn't exist without those.

- Felix

#3 lore raw
In reply to Felix Fietkau
Quoted 6 lines · Felix Fietkau

When ieee80211_monitor_select_queue encounters data frames, it selects the WMM AC based on skb->priority and assumes that skb->priority contains a valid 802.1d tag. However this assumption is incorrect, since ieee80211_select_queue has not been called at this point.
If skb->priority > 7, an array overrun occurs, which could lead to invalid values, resulting in crashes in the tx path.

What you describe here was already reported and fixed:

	http://marc.info/?l=linux-wireless&m=126287290723244&w=2
	http://git.kernel.org/?p=linux/kernel/git/linville/wireless-2.6.git;a=commit;h=045cfb71a3901005bf6dcedae98cecb3360a0bfc

Your commit message could at least acknowledge this. I.e. write that the existing fix doesn't handle QoS data frames in the optimal way, and then mention this:

Quoted 2 lines

Fix this by setting skb->priority based on the 802.11 header for QoS frames and using the default AC for all non-QoS frames.

#4 lore raw
Quoted 9 lines · Lennert Buytenhek
Quoted 6 lines · Felix Fietkau

When ieee80211_monitor_select_queue encounters data frames, it selects the WMM AC based on skb->priority and assumes that skb->priority contains a valid 802.1d tag. However this assumption is incorrect, since ieee80211_select_queue has not been called at this point.
If skb->priority > 7, an array overrun occurs, which could lead to invalid values, resulting in crashes in the tx path.

Quoted 8 lines

What you describe here was already reported and fixed:

	http://marc.info/?l=linux-wireless&m=126287290723244&w=2
	http://git.kernel.org/?p=linux/kernel/git/linville/wireless-2.6.git;a=commit;h=045cfb71a3901005bf6dcedae98cecb3360a0bfc

Your commit message could at least acknowledge this. I.e. write that the existing fix doesn't handle QoS data frames in the optimal way, and then mention this:

Sorry, when I wrote and posted the patch, I hadn't seen your previous fix yet, because I was apparently looking at the wrong tree and had not noticed your submission yet.
It only cleanly applied to a tree without your change, but it seems that John fixed it up and replaced your fix with it anyway.

- Felix

#5 lore raw
Quoted 15 lines · Felix Fietkau
Quoted 14 lines · Lennert Buytenhek
Quoted 6 lines · Felix Fietkau

When ieee80211_monitor_select_queue encounters data frames, it selects the WMM AC based on skb->priority and assumes that skb->priority contains a valid 802.1d tag. However this assumption is incorrect, since ieee80211_select_queue has not been called at this point.
If skb->priority > 7, an array overrun occurs, which could lead to invalid values, resulting in crashes in the tx path.

What you describe here was already reported and fixed:

      http://marc.info/?l=linux-wireless&m=126287290723244&w=2
      http://git.kernel.org/?p=linux/kernel/git/linville/wireless-2.6.git;a=commit;h=045cfb71a3901005bf6dcedae98cecb3360a0bfc

Quoted 8 lines
Quoted 3 lines

Your commit message could at least acknowledge this.  I.e. write that the existing fix doesn't handle QoS data frames in the optimal way, and then mention this:

Sorry, when I wrote and posted the patch, I hadn't seen your previous fix yet, because I was apparently looking at the wrong tree and had not noticed your submission yet.
It only cleanly applied to a tree without your change, but it seems that John fixed it up and replaced your fix with it anyway.

John, did the new changes by Felix get marked for stable too? From what I gather they apply on top of each other and are stable material.

Luis