* [PATCH]
@ 2008-05-02 22:35 Johannes Berg
2008-05-02 22:44 ` [PATCH v2] mac80211: fix wme code Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2008-05-02 22:35 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
In commit 31ccc476b77234f6afb3 (mac80211: QoS related cleanups) I
accidentally changed a variable from int to u16 causing a warning
that a comparison for < 0 was always false. John thought this was
a missing deletion of code and removed the warning by deleting the
never executed branch of code in commit 13e5f0888caddf7a020dcd918
(wireless: fix warning introduced by "mac80211: QoS related cleanups")
but the problem really was my mistake of using a u16 variable for
the queue variable when that variable can also contain an error
code. This patch restores the original code and variable type.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/wme.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
--- everything.orig/net/mac80211/wme.c 2008-05-03 00:29:07.000000000 +0200
+++ everything/net/mac80211/wme.c 2008-05-03 00:32:01.000000000 +0200
@@ -155,8 +155,7 @@ static int wme_qdiscop_enqueue(struct sk
unsigned short fc = le16_to_cpu(hdr->frame_control);
struct Qdisc *qdisc;
struct sta_info *sta;
- int err;
- u16 queue;
+ int err, queue;
u8 tid;
if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) {
@@ -216,15 +215,20 @@ static int wme_qdiscop_enqueue(struct sk
rcu_read_unlock();
}
- tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
- pkt_data->queue = (unsigned int) queue;
- qdisc = q->queues[queue];
- err = qdisc->enqueue(skb, qdisc);
- if (err == NET_XMIT_SUCCESS) {
- qd->q.qlen++;
- qd->bstats.bytes += skb->len;
- qd->bstats.packets++;
- return NET_XMIT_SUCCESS;
+ if (unlikely(queue < 0)) {
+ kfree_skb(skb);
+ err = NET_XMIT_DROP;
+ } else {
+ tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
+ pkt_data->queue = (unsigned int) queue;
+ qdisc = q->queues[queue];
+ err = qdisc->enqueue(skb, qdisc);
+ if (err == NET_XMIT_SUCCESS) {
+ qd->q.qlen++;
+ qd->bstats.bytes += skb->len;
+ qd->bstats.packets++;
+ return NET_XMIT_SUCCESS;
+ }
}
qd->qstats.drops++;
return err;
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2] mac80211: fix wme code
2008-05-02 22:35 [PATCH] Johannes Berg
@ 2008-05-02 22:44 ` Johannes Berg
2008-05-07 9:12 ` [PATCH v3] " Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2008-05-02 22:44 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
In commit 31ccc476b77234f6afb3 (mac80211: QoS related cleanups) I
accidentally changed a variable from int to u16 causing a warning
that a comparison for < 0 was always false. John thought this was
a missing deletion of code and removed the warning by deleting the
never executed branch of code in commit 13e5f0888caddf7a020dcd918
(wireless: fix warning introduced by "mac80211: QoS related cleanups")
but the problem really was my mistake of using a u16 variable for
the queue variable when that variable can also contain an error
code. This patch restores the original code and variable type.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
No functional change, just give it a subject...
net/mac80211/wme.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
--- everything.orig/net/mac80211/wme.c 2008-05-03 00:29:07.000000000 +0200
+++ everything/net/mac80211/wme.c 2008-05-03 00:32:01.000000000 +0200
@@ -155,8 +155,7 @@ static int wme_qdiscop_enqueue(struct sk
unsigned short fc = le16_to_cpu(hdr->frame_control);
struct Qdisc *qdisc;
struct sta_info *sta;
- int err;
- u16 queue;
+ int err, queue;
u8 tid;
if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) {
@@ -216,15 +215,20 @@ static int wme_qdiscop_enqueue(struct sk
rcu_read_unlock();
}
- tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
- pkt_data->queue = (unsigned int) queue;
- qdisc = q->queues[queue];
- err = qdisc->enqueue(skb, qdisc);
- if (err == NET_XMIT_SUCCESS) {
- qd->q.qlen++;
- qd->bstats.bytes += skb->len;
- qd->bstats.packets++;
- return NET_XMIT_SUCCESS;
+ if (unlikely(queue < 0)) {
+ kfree_skb(skb);
+ err = NET_XMIT_DROP;
+ } else {
+ tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
+ pkt_data->queue = (unsigned int) queue;
+ qdisc = q->queues[queue];
+ err = qdisc->enqueue(skb, qdisc);
+ if (err == NET_XMIT_SUCCESS) {
+ qd->q.qlen++;
+ qd->bstats.bytes += skb->len;
+ qd->bstats.packets++;
+ return NET_XMIT_SUCCESS;
+ }
}
qd->qstats.drops++;
return err;
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v3] mac80211: fix wme code
2008-05-02 22:44 ` [PATCH v2] mac80211: fix wme code Johannes Berg
@ 2008-05-07 9:12 ` Johannes Berg
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2008-05-07 9:12 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
In commit 31ccc476b77234f6afb3 (mac80211: QoS related cleanups) I
accidentally changed a variable from int to u16 causing a warning
that a comparison for < 0 was always false. John thought this was
a missing deletion of code and removed the warning by deleting the
never executed branch of code in commit 13e5f0888caddf7a020dcd918
(wireless: fix warning introduced by "mac80211: QoS related cleanups")
but the problem really was my mistake of using a u16 variable for
the queue variable when that variable can also contain an error
code. This patch restores the original code and variable type.
Additionally, this patch fixes a (currently) harmless mistake from
the same patch in the declaration of two arrays in the internal
header file.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/ieee80211_i.h | 4 ++--
net/mac80211/wme.c | 26 +++++++++++++++-----------
2 files changed, 17 insertions(+), 13 deletions(-)
--- everything.orig/net/mac80211/wme.c 2008-05-03 00:29:07.000000000 +0200
+++ everything/net/mac80211/wme.c 2008-05-07 11:09:12.000000000 +0200
@@ -155,8 +155,7 @@ static int wme_qdiscop_enqueue(struct sk
unsigned short fc = le16_to_cpu(hdr->frame_control);
struct Qdisc *qdisc;
struct sta_info *sta;
- int err;
- u16 queue;
+ int err, queue;
u8 tid;
if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) {
@@ -216,15 +215,20 @@ static int wme_qdiscop_enqueue(struct sk
rcu_read_unlock();
}
- tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
- pkt_data->queue = (unsigned int) queue;
- qdisc = q->queues[queue];
- err = qdisc->enqueue(skb, qdisc);
- if (err == NET_XMIT_SUCCESS) {
- qd->q.qlen++;
- qd->bstats.bytes += skb->len;
- qd->bstats.packets++;
- return NET_XMIT_SUCCESS;
+ if (unlikely(queue < 0)) {
+ kfree_skb(skb);
+ err = NET_XMIT_DROP;
+ } else {
+ tid = skb->priority & QOS_CONTROL_TAG1D_MASK;
+ pkt_data->queue = (unsigned int) queue;
+ qdisc = q->queues[queue];
+ err = qdisc->enqueue(skb, qdisc);
+ if (err == NET_XMIT_SUCCESS) {
+ qd->q.qlen++;
+ qd->bstats.bytes += skb->len;
+ qd->bstats.packets++;
+ return NET_XMIT_SUCCESS;
+ }
}
qd->qstats.drops++;
return err;
--- everything.orig/net/mac80211/ieee80211_i.h 2008-05-07 11:09:41.000000000 +0200
+++ everything/net/mac80211/ieee80211_i.h 2008-05-07 11:10:08.000000000 +0200
@@ -611,8 +611,8 @@ struct ieee80211_local {
struct sta_info *sta_hash[STA_HASH_SIZE];
struct timer_list sta_cleanup;
- unsigned long state[IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_AMPDU_QUEUES];
- struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_AMPDU_QUEUES];
+ unsigned long state[IEEE80211_MAX_QUEUES + IEEE80211_MAX_AMPDU_QUEUES];
+ struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES + IEEE80211_MAX_AMPDU_QUEUES];
struct tasklet_struct tx_pending_tasklet;
/* number of interfaces with corresponding IFF_ flags */
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH]
@ 2009-05-12 6:18 Johannes Berg
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2009-05-12 6:18 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Jouni Malinen
Subject: wext: remove seq_start/stop sparse annotations
Even though they are true, they cause sparse to complain
because it doesn't see the __acquires(dev_base_lock) on
dev_seq_start() because it is only added to the function
in net/core/dev.c, not the header file. To keep track of
the nesting correctly we should probably annotate those
functions publically, but for now let's just remove the
annotation I added to wext.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
I guess I should have actually run sparse... This could be part of the
wext locking fix "wext: fix get_wireless_stats locking" instead of being
standalone, if you're so inclined.
net/wireless/wext.c | 2 --
1 file changed, 2 deletions(-)
--- wireless-testing.orig/net/wireless/wext.c 2009-05-12 08:12:23.000000000 +0200
+++ wireless-testing/net/wireless/wext.c 2009-05-12 08:13:16.000000000 +0200
@@ -650,14 +650,12 @@ static int wireless_seq_show(struct seq_
}
static void *wireless_dev_seq_start(struct seq_file *seq, loff_t *pos)
- __acquires(dev_base_lock)
{
rtnl_lock();
return dev_seq_start(seq, pos);
}
static void wireless_dev_seq_stop(struct seq_file *seq, void *v)
- __releases(dev_base_lock)
{
dev_seq_stop(seq, v);
rtnl_unlock();
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH]
@ 2008-04-04 21:37 Johannes Berg
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2008-04-04 21:37 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
The ieee80211_ioctl_giwrate() ioctl handler doesn't rcu_read_lock()
its access to the sta table, fix it.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/ieee80211_ioctl.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
--- everything.orig/net/mac80211/ieee80211_ioctl.c 2008-04-04 17:48:11.000000000 +0200
+++ everything/net/mac80211/ieee80211_ioctl.c 2008-04-04 17:48:56.000000000 +0200
@@ -586,19 +586,25 @@ static int ieee80211_ioctl_giwrate(struc
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
- sta = sta_info_get(local, sdata->u.sta.bssid);
- else
+ if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
return -EOPNOTSUPP;
- if (!sta)
- return -ENODEV;
sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
- if (sta->txrate_idx < sband->n_bitrates)
+ rcu_read_lock();
+
+ sta = sta_info_get(local, sdata->u.sta.bssid);
+
+ if (sta && sta->txrate_idx < sband->n_bitrates)
rate->value = sband->bitrates[sta->txrate_idx].bitrate;
else
rate->value = 0;
+
+ rcu_read_unlock();
+
+ if (!sta)
+ return -ENODEV;
+
rate->value *= 100000;
return 0;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-05-12 6:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-02 22:35 [PATCH] Johannes Berg
2008-05-02 22:44 ` [PATCH v2] mac80211: fix wme code Johannes Berg
2008-05-07 9:12 ` [PATCH v3] " Johannes Berg
-- strict thread matches above, loose matches on Subject: below --
2009-05-12 6:18 [PATCH] Johannes Berg
2008-04-04 21:37 [PATCH] Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox