From: Bing Zhao <bzhao@marvell.com>
To: linux-wireless@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>,
Johannes Berg <johannes@sipsolutions.net>,
Amitkumar Karwar <akarwar@marvell.com>,
Kiran Divekar <dkiran@marvell.com>,
Frank Huang <frankh@marvell.com>, Bing Zhao <bzhao@marvell.com>
Subject: [PATCH 1/3] mwifiex: solve kernel dump issue for debugfs command 'debug'
Date: Mon, 20 Dec 2010 11:26:45 -0800 [thread overview]
Message-ID: <1292873207-9318-1-git-send-email-bzhao@marvell.com> (raw)
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
next reply other threads:[~2010-12-20 19:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-20 19:26 Bing Zhao [this message]
2010-12-20 19:26 ` [PATCH 2/3] mwifiex: remove set operation for debugfs command 'debug' Bing Zhao
2010-12-20 19:26 ` [PATCH 3/3] mwifiex: remove struct mwifiex_drv_timer and associated Bing Zhao
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=1292873207-9318-1-git-send-email-bzhao@marvell.com \
--to=bzhao@marvell.com \
--cc=akarwar@marvell.com \
--cc=dkiran@marvell.com \
--cc=frankh@marvell.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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