Linux wireless drivers development
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@qca.qualcomm.com>
To: kvalo@qca.qualcomm.com
Cc: ath6kl-devel@qualcomm.com, linux-wireless@vger.kernel.org
Subject: [PATCH v2 5/6] ath6kl: fix reading of FW IE capabilities
Date: Tue, 13 Dec 2011 14:51:58 +0200	[thread overview]
Message-ID: <20111213125158.10834.22898.stgit@localhost6.localdomain6> (raw)
In-Reply-To: <20111213124923.10834.20626.stgit@localhost6.localdomain6>

For some strange reason I used ALIGN() to calculate index to the
buffer. That is totally bogus and wouldn't work when it tried to read
the second bit. Fix it by removing the ALIGN() altogether.

Also check that ie_len is not too short.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath6kl/init.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index c97f83c..5753f00 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -913,12 +913,15 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar)
 				   ar->hw.reserved_ram_size);
 			break;
 		case ATH6KL_FW_IE_CAPABILITIES:
+			if (ie_len < DIV_ROUND_UP(ATH6KL_FW_CAPABILITY_MAX, 8))
+				break;
+
 			ath6kl_dbg(ATH6KL_DBG_BOOT,
 				   "found firmware capabilities ie (%zd B)\n",
 				   ie_len);
 
 			for (i = 0; i < ATH6KL_FW_CAPABILITY_MAX; i++) {
-				index = ALIGN(i, 8) / 8;
+				index = i / 8;
 				bit = i % 8;
 
 				if (data[index] & (1 << bit))


  parent reply	other threads:[~2011-12-13 12:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13 12:50 [PATCH v2 0/6] ath6kl: scheduled scan support Kalle Valo
2011-12-13 12:51 ` [PATCH v2 1/6] ath6kl: remove a workaround from ath6kl_cfg80211_stop() Kalle Valo
2011-12-13 12:51 ` [PATCH v2 2/6] ath6kl: call ath6kl_cfg80211_stop() from ath6kl_close() Kalle Valo
2011-12-13 12:51 ` [PATCH v2 3/6] ath6kl: implement ath6kl_cfg80211_stop_all() Kalle Valo
2011-12-13 12:51 ` [PATCH v2 4/6] ath6kl: fix value of WOW_FILTER_SSID Kalle Valo
2011-12-13 12:51 ` Kalle Valo [this message]
2011-12-13 12:52 ` [PATCH v2 6/6] ath6kl: implement scheduled scan Kalle Valo
2011-12-13 13:06 ` [PATCH v2 0/6] ath6kl: scheduled scan support Kalle Valo

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=20111213125158.10834.22898.stgit@localhost6.localdomain6 \
    --to=kvalo@qca.qualcomm.com \
    --cc=ath6kl-devel@qualcomm.com \
    --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