diff options
author | Luis Carlos Cobo <luisca@cozybit.com> | 2008-03-31 18:10:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-04-01 17:14:11 -0400 |
commit | 73bb3e4a7a9f1b8d5f89c3991bd0c904ab0b8e27 (patch) | |
tree | 01a6474fa7c14c6c76ff5ca1f9dd86365ac20bcc /net/mac80211/debugfs_netdev.c | |
parent | 7e879b551f1ada78d66fa5c6914aa1744b9c97d2 (diff) |
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>
Diffstat (limited to 'net/mac80211/debugfs_netdev.c')
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 0e921aef8ecf..3e19d42e61cb 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -31,11 +31,13 @@ static ssize_t ieee80211_if_read( | |||
31 | ssize_t ret = -EINVAL; | 31 | ssize_t ret = -EINVAL; |
32 | 32 | ||
33 | read_lock(&dev_base_lock); | 33 | read_lock(&dev_base_lock); |
34 | if (sdata->dev->reg_state == NETREG_REGISTERED) { | 34 | if (sdata->dev->reg_state == NETREG_REGISTERED) |
35 | ret = (*format)(sdata, buf, sizeof(buf)); | 35 | ret = (*format)(sdata, buf, sizeof(buf)); |
36 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret); | ||
37 | } | ||
38 | read_unlock(&dev_base_lock); | 36 | read_unlock(&dev_base_lock); |
37 | |||
38 | if (ret != -EINVAL) | ||
39 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret); | ||
40 | |||
39 | return ret; | 41 | return ret; |
40 | } | 42 | } |
41 | 43 | ||
@@ -51,13 +53,13 @@ static ssize_t ieee80211_if_write( | |||
51 | 53 | ||
52 | memset(buf, 0x00, sizeof(buf)); | 54 | memset(buf, 0x00, sizeof(buf)); |
53 | buf_size = min(count, (sizeof(buf)-1)); | 55 | buf_size = min(count, (sizeof(buf)-1)); |
54 | read_lock(&dev_base_lock); | ||
55 | if (copy_from_user(buf, userbuf, buf_size)) | 56 | if (copy_from_user(buf, userbuf, buf_size)) |
56 | goto endwrite; | 57 | return count; |
58 | read_lock(&dev_base_lock); | ||
57 | if (sdata->dev->reg_state == NETREG_REGISTERED) | 59 | if (sdata->dev->reg_state == NETREG_REGISTERED) |
58 | (*format)(sdata, buf); | 60 | (*format)(sdata, buf); |
59 | endwrite: | ||
60 | read_unlock(&dev_base_lock); | 61 | read_unlock(&dev_base_lock); |
62 | |||
61 | return count; | 63 | return count; |
62 | } | 64 | } |
63 | #endif | 65 | #endif |