2012-04-24 19:50:49

by Thomas Pedersen

[permalink] [raw]
Subject: [PATCH] ath6kl: check for sband existence when creating scan cmd

The patch "ath6kl: support fw reporting phy capabilities" gave the
firmware the ability to disable certain wiphy supported bands. Check if
this is the case in ath6kl_wmi_beginscan_cmd to avoid dereferencing a
NULL pointer.

Signed-off-by: Thomas Pedersen <[email protected]>
---
drivers/net/wireless/ath/ath6kl/wmi.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 2eb771a..9186f8e 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -1851,6 +1851,8 @@ int ath6kl_wmi_beginscan_cmd(struct wmi *wmi, u8 if_idx,
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
struct ieee80211_supported_band *sband =
ar->wiphy->bands[band];
+ if (!sband)
+ continue;
u32 ratemask = rates[band];
u8 *supp_rates = sc->supp_rates[band].rates;
num_rates = 0;
--
1.7.4.1



2012-04-25 06:38:41

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] ath6kl: check for sband existence when creating scan cmd

On 04/24/2012 10:50 PM, Thomas Pedersen wrote:
> The patch "ath6kl: support fw reporting phy capabilities" gave the
> firmware the ability to disable certain wiphy supported bands. Check if
> this is the case in ath6kl_wmi_beginscan_cmd to avoid dereferencing a
> NULL pointer.
>
> Signed-off-by: Thomas Pedersen <[email protected]>

Thanks, applied with changes. I really didn't like mixing code and
declarations so I changed the code a bit and added few empty lines for
readibility. There shouldn't be any functional changes but please do
check my changes.

Kalle