From: Johannes Berg <johannes@sipsolutions.net>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: Michael Wu <flamingice@sourmilk.net>,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: don't allow registering the same rate control twice
Date: Sun, 28 Oct 2007 14:49:33 +0100 [thread overview]
Message-ID: <1193579374.5197.5.camel@johannes.berg> (raw)
Previously, mac80211 would allow registering the same rate control
algorithm twice. This is a programming error in the registration
and should not happen; additionally the second version could never
be selected. Disallow this and warn about it.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
There could be potential for data corruption here when one
algorithm is registered twice depending on how the algorithm
code is written (it might only expect to be registered once),
so I think this should be applied for 2.6.24.
net/mac80211/ieee80211_rate.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- linux-2.6.orig/net/mac80211/ieee80211_rate.c 2007-10-28 14:43:47.835043456 +0100
+++ linux-2.6/net/mac80211/ieee80211_rate.c 2007-10-28 14:46:20.907430120 +0100
@@ -28,13 +28,22 @@ int ieee80211_rate_control_register(stru
if (!ops->name)
return -EINVAL;
+ mutex_lock(&rate_ctrl_mutex);
+ list_for_each_entry(alg, &rate_ctrl_algs, list) {
+ if (!strcmp(alg->ops->name, ops->name)) {
+ /* don't register an algorithm twice */
+ WARN_ON(1);
+ return -EALREADY;
+ }
+ }
+
alg = kzalloc(sizeof(*alg), GFP_KERNEL);
if (alg == NULL) {
+ mutex_unlock(&rate_ctrl_mutex);
return -ENOMEM;
}
alg->ops = ops;
- mutex_lock(&rate_ctrl_mutex);
list_add_tail(&alg->list, &rate_ctrl_algs);
mutex_unlock(&rate_ctrl_mutex);
reply other threads:[~2007-10-28 13:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1193579374.5197.5.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=flamingice@sourmilk.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox