From: "Luis R. Rodriguez" <mcgrof@gmail.com>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"John W. Linville" <linville@tuxdriver.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: regd: sleeping in atomic
Date: Tue, 16 Mar 2010 09:18:31 -0700 [thread overview]
Message-ID: <43e72e891003160918x3b7e3c9asf4fc8a9db35ccd8a@mail.gmail.com> (raw)
In-Reply-To: <4B9F86E9.2030702@gmail.com>
2010/3/16 Jiri Slaby <jirislaby@gmail.com>:
> Hi,
>
> Stanse found an atomic error in reg_copy_regd:
>
> static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd,
> const struct ieee80211_regdomain *src_regd)
> {
> struct ieee80211_regdomain *regd;
> int size_of_regd = 0;
> unsigned int i;
>
> size_of_regd = sizeof(struct ieee80211_regdomain) +
> ((src_regd->n_reg_rules + 1) * sizeof(struct ieee80211_reg_rule));
>
> regd = kzalloc(size_of_regd, GFP_KERNEL); <---- here
>
> Called from:
>
> static void reg_regdb_search(struct work_struct *work)
> {
> spin_lock(®_regdb_search_lock);
> while (!list_empty(®_regdb_search_list)) {
> ...
> for (i=0; i<reg_regdb_size; i++) {
> curdom = reg_regdb[i];
>
> if (!memcmp(request->alpha2, curdom->alpha2, 2)) {
> r = reg_copy_regd(®dom, curdom);
> ...
> spin_unlock(®_regdb_search_lock);
> }
>
> Whole error temporarily available at:
> http://decibel.fi.muni.cz/~xslaby/stanse/error.cgi?db=34-rc&id=578
>
> It is introduced by 3b377ea9d4efc94dc52fe41b4dfdb463635ab298.
>
> Do you plan to extend it somehow or may the spinlock be converted to mutex?
I don't think you can convert this directly to a mutex. The spin_lock
in question (®_regdb_search_lock) gets also used by
reg_regdb_query() which in turn gets called by call_crda(). There is
one iteration of call_crda() which happens during module
initialization and from what I gather I don't think the kernel is
happy when you mutex_lock on load routines, please correct my foggy
memory if I am mistaken. So during module load we directly end up
hitting the spin_lock in question, prior to the workqueue using it.
Not sure yet how to address this, any ideas John?
> If not how much may size_of_regd be -- can we safely switch to GFP_ATOMIC?
The count is up to 117 right now. It should be around the number of
countries of the world today, tomorrow even different countries could
have different regulatory domains. This happened with Japan a while
back when they required manufacturers to apply certification rules
depending on the year the product went out.. and this changed many
times in that country. But another reason why this number may also
increase in any given country without regards to silly legislation is
for experimenters who want to enhance the use of the spectrum in
certain areas and would use sha1sums instead of alpha2s for the
regdomains. But we're light years away from that happening.
Luis
next prev parent reply other threads:[~2010-03-16 16:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 13:26 Jiri Slaby
2010-03-16 16:18 ` Luis R. Rodriguez [this message]
2010-03-16 18:42 ` Jiri Slaby
2010-03-16 20:36 ` Luis R. Rodriguez
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=43e72e891003160918x3b7e3c9asf4fc8a9db35ccd8a@mail.gmail.com \
--to=mcgrof@gmail.com \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®