Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH 1/3] mwifiex: solve kernel dump issue for debugfs command 'debug'
@ 2010-12-20 19:26 Bing Zhao
  2010-12-20 19:26 ` [PATCH 2/3] mwifiex: remove set operation " Bing Zhao
  2010-12-20 19:26 ` [PATCH 3/3] mwifiex: remove struct mwifiex_drv_timer and associated Bing Zhao
  0 siblings, 2 replies; 3+ messages in thread
From: Bing Zhao @ 2010-12-20 19:26 UTC (permalink / raw)
  To: linux-wireless
  Cc: John W. Linville, Johannes Berg, Amitkumar Karwar, Kiran Divekar,
	Frank Huang, Bing Zhao

From: Amitkumar Karwar <akarwar@marvell.com>

Issue is when card is reinserted (without unloading the driver),
"cat /debugfs/mwifiex/mlan0/debug" command gives kernel dump.

Actually while handling this command some elements of "struct
mwifiex_adapter *adapter"and "struct mwifiex_debug_info *info"
are read by adding structure address to element offset
and displayed them to console.
When the card is reinserted, mwifiex_dev_debugfs_init() function
is called and addresses used for reading those elements (which are
correct ones) are unnecessorily incremented by structure addresses.

Fixed this issue by using separate variable to store final address
while reading structure elements instead of incrementing same
variable.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
 drivers/net/wireless/mwifiex/debugfs.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c
index 9d23c68..2b642f1 100644
--- a/drivers/net/wireless/mwifiex/debugfs.c
+++ b/drivers/net/wireless/mwifiex/debugfs.c
@@ -430,7 +430,11 @@ mwifiex_debug_read(struct file *file, char __user *ubuf,
 		p += sprintf(p, "%s=", d[i].name);
 
 		size = d[i].size / d[i].num;
-		addr = d[i].addr;
+
+		if (i < (num_of_items - 3))
+			addr = d[i].addr + (size_t) &info;
+		else /* The last 3 items are struct mwifiex_adapter variables */
+			addr = d[i].addr + (size_t) priv->adapter;
 
 		for (j = 0; j < d[i].num; j++) {
 			switch (size) {
@@ -2459,8 +2463,6 @@ MWIFIEX_DFS_FILE_READ_OPS(esuppmode);
 void
 mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
 {
-	int i;
-
 	ENTER();
 
 	if (!mwifiex_dfs_dir || !priv)
@@ -2472,14 +2474,6 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
 	if (!priv->dfs_dev_dir)
 		goto exit;
 
-	/* The last 3 items are struct mwifiex_adapter variables */
-	for (i = 0; i < num_of_items - 3; i++)
-		items[i].addr += (size_t) &info;
-
-	for (; i < num_of_items; i++)
-		items[i].addr += (size_t) priv->adapter;
-
-
 	MWIFIEX_DFS_ADD_FILE(info);
 	MWIFIEX_DFS_ADD_FILE(debug);
 	MWIFIEX_DFS_ADD_FILE(deepsleep);
-- 
1.7.0.2


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

end of thread, other threads:[~2010-12-20 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-20 19:26 [PATCH 1/3] mwifiex: solve kernel dump issue for debugfs command 'debug' Bing Zhao
2010-12-20 19:26 ` [PATCH 2/3] mwifiex: remove set operation " Bing Zhao
2010-12-20 19:26 ` [PATCH 3/3] mwifiex: remove struct mwifiex_drv_timer and associated Bing Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox