Linux wireless drivers development
 help / color / mirror / Atom feed
From: Lekensteyn <lekensteyn@gmail.com>
To: Johannes Berg <johannes.berg@intel.com>,
	Wey-Yi Guy <wey-yi.w.guy@intel.com>,
	Intel Linux Wireless <ilw@linux.intel.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] iwlwifi: fix Oops on reading debugfs log_event
Date: Sun, 17 Jun 2012 22:58:30 +0200	[thread overview]
Message-ID: <7841457.8s9HYuaGXa@penguin> (raw)

Before this patch, reading log_event would print the event log to syslog and
crash if CONFIG_IWLWIFI_DEBUG was disabled (while CONFIG_IWLWIFI_DEBUGFS was
enabled of course). The crash was caused by (1) iwl_dbgfs_log_event_read failing
to initialize variable buf, thereby causing the following kfree(buf) to be
executed. (2) iwl_dump_nic_event_log does not initialize buf if
CONFIG_IWLWIFI_DEBUG was disabled.

Tested-by: Lekensteyn <lekensteyn@gmail.com>
Signed-off-by: Lekensteyn <lekensteyn@gmail.com>
---
 drivers/net/wireless/iwlwifi/dvm/debugfs.c |    2 +-
 drivers/net/wireless/iwlwifi/dvm/main.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
index 8a2d9e6..e315dc7 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
@@ -2233,7 +2233,7 @@ static ssize_t iwl_dbgfs_log_event_read(struct file *file,
 					 size_t count, loff_t *ppos)
 {
 	struct iwl_priv *priv = file->private_data;
-	char *buf;
+	char *buf = NULL;
 	int pos = 0;
 	ssize_t ret = -ENOMEM;
 
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
index e620af3..b28ab67 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
@@ -1915,7 +1915,6 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
 	IWL_ERR(priv, "Start IWL Event Log Dump: display last %u entries\n",
 		size);
 
-#ifdef CONFIG_IWLWIFI_DEBUG
 	if (display) {
 		if (full_log)
 			bufsz = capacity * 48;
@@ -1925,6 +1924,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
 		if (!*buf)
 			return -ENOMEM;
 	}
+#ifdef CONFIG_IWLWIFI_DEBUG
 	if (iwl_have_debug_level(IWL_DL_FW_ERRORS) || full_log) {
 		/*
 		 * if uCode has wrapped back to top of log,
-- 
1.7.9.5



             reply	other threads:[~2012-06-17 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-17 20:58 Lekensteyn [this message]
2012-06-17 22:05 ` [PATCH] iwlwifi: fix Oops on reading debugfs log_event Joe Perches
2012-06-18  7:31   ` Johannes Berg
2012-06-19  7:20 ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7841457.8s9HYuaGXa@penguin \
    --to=lekensteyn@gmail.com \
    --cc=ilw@linux.intel.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wey-yi.w.guy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox