mac80211: fix deadlocks in debugfs_netdev.c
The bug shows up with CONFIG_PREEMPT enabled. Pointed out by Andrew Morton. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Luis Carlos Cobo <luisca@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
7e879b551f
commit
73bb3e4a7a
@@ -31,11 +31,13 @@ static ssize_t ieee80211_if_read(
|
|||||||
ssize_t ret = -EINVAL;
|
ssize_t ret = -EINVAL;
|
||||||
|
|
||||||
read_lock(&dev_base_lock);
|
read_lock(&dev_base_lock);
|
||||||
if (sdata->dev->reg_state == NETREG_REGISTERED) {
|
if (sdata->dev->reg_state == NETREG_REGISTERED)
|
||||||
ret = (*format)(sdata, buf, sizeof(buf));
|
ret = (*format)(sdata, buf, sizeof(buf));
|
||||||
ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
|
|
||||||
}
|
|
||||||
read_unlock(&dev_base_lock);
|
read_unlock(&dev_base_lock);
|
||||||
|
|
||||||
|
if (ret != -EINVAL)
|
||||||
|
ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,13 +53,13 @@ static ssize_t ieee80211_if_write(
|
|||||||
|
|
||||||
memset(buf, 0x00, sizeof(buf));
|
memset(buf, 0x00, sizeof(buf));
|
||||||
buf_size = min(count, (sizeof(buf)-1));
|
buf_size = min(count, (sizeof(buf)-1));
|
||||||
read_lock(&dev_base_lock);
|
|
||||||
if (copy_from_user(buf, userbuf, buf_size))
|
if (copy_from_user(buf, userbuf, buf_size))
|
||||||
goto endwrite;
|
return count;
|
||||||
|
read_lock(&dev_base_lock);
|
||||||
if (sdata->dev->reg_state == NETREG_REGISTERED)
|
if (sdata->dev->reg_state == NETREG_REGISTERED)
|
||||||
(*format)(sdata, buf);
|
(*format)(sdata, buf);
|
||||||
endwrite:
|
|
||||||
read_unlock(&dev_base_lock);
|
read_unlock(&dev_base_lock);
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user