From: Amitkumar Karwar <akarwar@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html