From: Johannes Berg Date: Thu, 27 Feb 2014 01:52:56 +0000 (+0800) Subject: iwlwifi: protect SRAM debugfs X-Git-Tag: v3.4.83~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8234281aea5f98e5216a01d4955ce44025e95212;p=thirdparty%2Fkernel%2Fstable.git iwlwifi: protect SRAM debugfs commit 4fc79db178f0a0ede479b4713e00df2d106028b3 upstream. If the device is not started, we can't read its SRAM and attempting to do so will cause issues. Protect the debugfs read. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville [wujg: Backported to 3.4: adjust context] Signed-off-by: Jianguo Wu Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 2bbaebd99ad42..d587bcdda015c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c @@ -227,6 +227,9 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file, const struct fw_img *img; size_t bufsz; + if (!iwl_is_ready_rf(priv)) + return -EAGAIN; + /* default is to dump the entire data segment */ if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { priv->dbgfs_sram_offset = 0x800000;