mac80211: fix deadlocks in debugfs_netdev.c
PATCH 1/1 mac80211: fix deadlocks in debugfs_netdev.c
The bug shows up with CONFIG_PREEMPT enabled. Pointed out by Andrew Morton.
--- net/mac80211/debugfs_netdev.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
net/mac80211/debugfs_netdev.c +8 -6
@@ -31,11 +31,13 @@ static ssize_t ieee80211_if_read(ssize_t ret = -EINVAL ;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 =simple_read_from_buffer (userbuf, count, ppos, buf, ret); - }read_unlock (&dev_base_lock); + +if (ret != -EINVAL ) + ret =simple_read_from_buffer (userbuf, count, ppos, buf, ret); +return ret; }
@@ -51,13 +53,13 @@ static ssize_t ieee80211_if_write(memset (buf,0x00 ,sizeof (buf)); buf_size =min (count, (sizeof (buf)-1 )); -read_lock (&dev_base_lock);if (copy_from_user (buf, userbuf, buf_size)) - goto endwrite; +return count; +read_lock (&dev_base_lock);if (sdata->dev->reg_state ==NETREG_REGISTERED ) (*format)(sdata, buf); -endwrite:read_unlock (&dev_base_lock); + return count; }#endif
Signature · 1 line
1.5.4.3
Johannes Berg
maintainernet/mac80211/debugfs_netdev.c static ssize_t ieee80211_if_write( · line 56
Quoted 8 lines · Luis Carlos Cobo
The bug shows up with
CONFIG_PREEMPTenabled. Pointed out by Andrew Morton.net/mac80211/debugfs_netdev.c +0
-1@@ -51,13 +53,13 @@ static ssize_t ieee80211_if_write(memset (buf,0x00 ,sizeof (buf)); buf_size =min (count, (sizeof (buf)-1 )); -read_lock (&dev_base_lock);if (copy_from_user (buf, userbuf, buf_size))
Do we actually still need all this ieee80211_if_write code? It seems that nl80211 can fully replace it now.
johannes
Quoted 5 lines · Johannes Berg
Quoted 4 lines · Luis Carlos Cobo
The bug shows up with
CONFIG_PREEMPTenabled. Pointed out by Andrew Morton.(quoted diff) +0
-0@@ -51,13 +53,13 @@ static ssize_t ieee80211_if_write(
Quoted 7 lines
net/mac80211/debugfs_netdev.c static ssize_t ieee80211_if_write( · line 56
Quoted 4 lines
net/mac80211/debugfs_netdev.c +0
-1memset (buf,0x00 ,sizeof (buf)); buf_size =min (count, (sizeof (buf)-1 )); -read_lock (&dev_base_lock);if (copy_from_user (buf, userbuf, buf_size))Do we actually still need all this
ieee80211_if_writecode? It seems that nl80211 can fully replace it now.
Yes we do. We cannot tune mesh parameters (Mesh TTL, auto open peer links, retries, timeouts, and other dozen parameters) through nl80211.
As the values for those parameters are not yet defined, these knobs are very useful for performance analysis.
Signature · 2 lines
Luis Carlos Cobo Rus GnuPG ID: 44019B60 cozybit Inc.