regd: sleeping in atomic

From: Jiri Slaby
Date: Tue Mar 16 2010 - 09:26:15 EST


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(&reg_regdb_search_lock);
while (!list_empty(&reg_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(&regdom, curdom);
...
spin_unlock(&reg_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? If not how much may size_of_regd be -- can we safely switch to GFP_ATOMIC?

--
js
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/