aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard A. Griffiths <richardx.a.griffiths@intel.com>2012-06-28 16:14:11 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-03 08:03:26 -0400
commit0ff1bd35f5aece42879b04cbfe6b4040cf50a697 (patch)
treed6e58a2fc91c3febd77651458a8a0e1dd2e0c499
parentbd408b33363035275403cfaadf2683d8c8e22dd7 (diff)
iwlwifi: disallow log_event access if interface down
'echo 1 > log_event' generates the bogus "MAC is in deep sleep" or "Timeout waiting for hardware access" log messages when the interface is down, we should just disallow accessing the device through debugfs when it is down. Signed-off-by: Richard A. Griffiths <richardx.a.griffiths@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/debugfs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
index 8a2d9e643b14..b0f125c985cd 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
@@ -83,7 +83,7 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \
83#define DEBUGFS_READ_FILE_OPS(name) \ 83#define DEBUGFS_READ_FILE_OPS(name) \
84 DEBUGFS_READ_FUNC(name); \ 84 DEBUGFS_READ_FUNC(name); \
85static const struct file_operations iwl_dbgfs_##name##_ops = { \ 85static const struct file_operations iwl_dbgfs_##name##_ops = { \
86 .read = iwl_dbgfs_##name##_read, \ 86 .read = iwl_dbgfs_##name##_read, \
87 .open = simple_open, \ 87 .open = simple_open, \
88 .llseek = generic_file_llseek, \ 88 .llseek = generic_file_llseek, \
89}; 89};
@@ -2254,6 +2254,10 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file,
2254 char buf[8]; 2254 char buf[8];
2255 int buf_size; 2255 int buf_size;
2256 2256
2257 /* check that the interface is up */
2258 if (!iwl_is_ready(priv))
2259 return -EAGAIN;
2260
2257 memset(buf, 0, sizeof(buf)); 2261 memset(buf, 0, sizeof(buf));
2258 buf_size = min(count, sizeof(buf) - 1); 2262 buf_size = min(count, sizeof(buf) - 1);
2259 if (copy_from_user(buf, user_buf, buf_size)) 2263 if (copy_from_user(buf, user_buf, buf_size))