From: Andreas Kemnade <andreas@kemnade.info>
To: libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org,
linux-kernel@vger.kernel.org, hns@goldelico.com
Cc: Andreas Kemnade <andreas@kemnade.info>
Subject: [PATCH v3 1/6] libertas: fix pointer bugs for PS_MODE commands
Date: Sat, 30 Jan 2016 18:01:51 +0100 [thread overview]
Message-ID: <1454173316-13444-2-git-send-email-andreas@kemnade.info> (raw)
In-Reply-To: <1454173316-13444-1-git-send-email-andreas@kemnade.info>
struct cmd_ds_802_11_ps_mode
contains the command header and a pointer to it was
initialized with data points to the body which leads to
mis-interpretation of the cmd_ds_802_11_ps_mode.action member.
cmd[0] contains the header, &cmd[1] points beyond that.
cmdnode->cmdbuf is a pointer to the command buffer
This piece of code was unused since power saving was
not enabled.
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
changes in v3:
corrected paths
changes in v2:
improved commit message
drivers/net/wireless/marvell/libertas/cmd.c | 4 ++--
drivers/net/wireless/marvell/libertas/cmdresp.c | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/marvell/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 0387a5b..40467d6 100644
--- a/drivers/net/wireless/marvell/libertas/cmd.c
+++ b/drivers/net/wireless/marvell/libertas/cmd.c
@@ -957,7 +957,7 @@ static void lbs_queue_cmd(struct lbs_private *priv,
/* Exit_PS command needs to be queued in the header always. */
if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) {
- struct cmd_ds_802_11_ps_mode *psm = (void *) &cmdnode->cmdbuf;
+ struct cmd_ds_802_11_ps_mode *psm = (void *)cmdnode->cmdbuf;
if (psm->action == cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) {
if (priv->psstate != PS_STATE_FULL_POWER)
@@ -1387,7 +1387,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
* PS command. Ignore it if it is not Exit_PS.
* otherwise send it down immediately.
*/
- struct cmd_ds_802_11_ps_mode *psm = (void *)&cmd[1];
+ struct cmd_ds_802_11_ps_mode *psm = (void *)cmd;
lbs_deb_host(
"EXEC_NEXT_CMD: PS cmd, action 0x%02x\n",
diff --git a/drivers/net/wireless/marvell/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index e5442e8..701125f 100644
--- a/drivers/net/wireless/marvell/libertas/cmdresp.c
+++ b/drivers/net/wireless/marvell/libertas/cmdresp.c
@@ -123,7 +123,10 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
priv->cmd_timed_out = 0;
if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
- struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1];
+ /* struct cmd_ds_802_11_ps_mode also contains
+ * the header
+ */
+ struct cmd_ds_802_11_ps_mode *psmode = (void *)resp;
u16 action = le16_to_cpu(psmode->action);
lbs_deb_host(
--
2.1.4
next prev parent reply other threads:[~2016-01-30 17:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-30 17:01 [PATCH v3 0/6] libertas: ieee80211 powersave mode Andreas Kemnade
2016-01-30 17:01 ` Andreas Kemnade [this message]
2016-02-06 12:02 ` [v3,1/6] libertas: fix pointer bugs for PS_MODE commands Kalle Valo
2016-01-30 17:01 ` [PATCH v3 2/6] libertas: check whether bus can do more than polling Andreas Kemnade
2016-01-30 17:01 ` [PATCH v3 3/6] libertas: do not confirm sleep if commands are pending Andreas Kemnade
2016-01-30 17:01 ` [PATCH v3 4/6] libertas: go back to ps mode without commands pending Andreas Kemnade
2016-01-30 17:01 ` [PATCH v3 5/6] libertas: fix ps-mode related removal problems Andreas Kemnade
2016-01-30 17:01 ` [PATCH v3 6/6] libertas: add an cfg80211 interface for powersaving Andreas Kemnade
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=1454173316-13444-2-git-send-email-andreas@kemnade.info \
--to=andreas@kemnade.info \
--cc=hns@goldelico.com \
--cc=libertas-dev@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).