All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iwlwifi: fix Oops on reading debugfs log_event
@ 2012-06-17 20:58 Lekensteyn
  2012-06-17 22:05 ` Joe Perches
  2012-06-19  7:20 ` Johannes Berg
  0 siblings, 2 replies; 4+ messages in thread
From: Lekensteyn @ 2012-06-17 20:58 UTC (permalink / raw)
  To: Johannes Berg, Wey-Yi Guy, Intel Linux Wireless; +Cc: linux-wireless

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iwlwifi: fix Oops on reading debugfs log_event
  2012-06-17 20:58 [PATCH] iwlwifi: fix Oops on reading debugfs log_event Lekensteyn
@ 2012-06-17 22:05 ` Joe Perches
  2012-06-18  7:31   ` Johannes Berg
  2012-06-19  7:20 ` Johannes Berg
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2012-06-17 22:05 UTC (permalink / raw)
  To: Lekensteyn
  Cc: Johannes Berg, Wey-Yi Guy, Intel Linux Wireless, linux-wireless

On Sun, 2012-06-17 at 22:58 +0200, Lekensteyn wrote:
> 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).

Make CONFIG_IWLWIFI_DEBUGFS dependent on CONFIG_IWLWIFI_DEBUG?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iwlwifi: fix Oops on reading debugfs log_event
  2012-06-17 22:05 ` Joe Perches
@ 2012-06-18  7:31   ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2012-06-18  7:31 UTC (permalink / raw)
  To: Joe Perches; +Cc: Lekensteyn, Wey-Yi Guy, Intel Linux Wireless, linux-wireless

On Sun, 2012-06-17 at 15:05 -0700, Joe Perches wrote:
> On Sun, 2012-06-17 at 22:58 +0200, Lekensteyn wrote:
> > 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).

I'll look at the patch, thanks.

> Make CONFIG_IWLWIFI_DEBUGFS dependent on CONFIG_IWLWIFI_DEBUG?

It's intentionally not dependent on each other today.

johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iwlwifi: fix Oops on reading debugfs log_event
  2012-06-17 20:58 [PATCH] iwlwifi: fix Oops on reading debugfs log_event Lekensteyn
  2012-06-17 22:05 ` Joe Perches
@ 2012-06-19  7:20 ` Johannes Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2012-06-19  7:20 UTC (permalink / raw)
  To: Lekensteyn; +Cc: Wey-Yi Guy, Intel Linux Wireless, linux-wireless

On Sun, 2012-06-17 at 22:58 +0200, Lekensteyn wrote:
> 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.

I've applied a different fix for this, just disabling the log_event file
when CONFIG_IWLWIFI_DEBUG is disabled. This looks like it could use some
disentangling but I'm not sure what you did is really the right
approach, some refactoring would seem to be better.

Also, is "Lekensteyn" really your full name? Not that it matters now
because I didn't apply your patch, but for patch submissions please read
the "developer's certificate of origin" in the kernel sources.

Thanks for the report!

johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-19  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-17 20:58 [PATCH] iwlwifi: fix Oops on reading debugfs log_event Lekensteyn
2012-06-17 22:05 ` Joe Perches
2012-06-18  7:31   ` Johannes Berg
2012-06-19  7:20 ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.