* Re: [PATCH][next] ath11k: avoid null pointer dereference when pointer band is null
@ 2020-01-11 9:50 linmiaohe
[not found] ` <64797126-0c77-4c2c-ad2b-29d7af452c13@wanadoo.fr>
0 siblings, 1 reply; 5+ messages in thread
From: linmiaohe @ 2020-01-11 9:50 UTC (permalink / raw)
To: Colin King
Cc: Kalle Valo, David S . Miller, John Crispin, Shashidhar Lakkavalli,
ath11k@lists.infradead.org, linux-wireless@vger.kernel.org,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Colin Ian King <colin.king@canonical.com> wrote:
>From: Colin Ian King <colin.king@canonical.com>
>
>In the unlikely event that cap->supported_bands has neither WMI_HOST_WLAN_2G_CAP set or WMI_HOST_WLAN_5G_CAP set then pointer band is null and a null dereference occurs when assigning
>band->n_iftype_data. Move the assignment to the if blocks to
>avoid this. Cleans up static analysis warnings.
>
>Addresses-Coverity: ("Explicit null dereference")
>Fixes: 9f056ed8ee01 ("ath11k: add HE support")
>Signed-off-by: Colin Ian King <colin.king@canonical.com>
>---
> drivers/net/wireless/ath/ath11k/mac.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
It looks fine for me. Thanks.
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH][next] ath11k: avoid null pointer dereference when pointer band is null
@ 2020-01-11 9:08 Colin King
2020-01-26 10:48 ` Kalle Valo
0 siblings, 1 reply; 5+ messages in thread
From: Colin King @ 2020-01-11 9:08 UTC (permalink / raw)
To: Kalle Valo, David S . Miller, John Crispin, Shashidhar Lakkavalli,
ath11k, linux-wireless, netdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
In the unlikely event that cap->supported_bands has neither
WMI_HOST_WLAN_2G_CAP set or WMI_HOST_WLAN_5G_CAP set then pointer
band is null and a null dereference occurs when assigning
band->n_iftype_data. Move the assignment to the if blocks to
avoid this. Cleans up static analysis warnings.
Addresses-Coverity: ("Explicit null dereference")
Fixes: 9f056ed8ee01 ("ath11k: add HE support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/wireless/ath/ath11k/mac.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 556eef9881a7..4a364cfe37ed 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -3520,8 +3520,8 @@ static int ath11k_mac_copy_he_cap(struct ath11k *ar,
static void ath11k_mac_setup_he_cap(struct ath11k *ar,
struct ath11k_pdev_cap *cap)
{
- struct ieee80211_supported_band *band = NULL;
- int count = 0;
+ struct ieee80211_supported_band *band;
+ int count;
if (cap->supported_bands & WMI_HOST_WLAN_2G_CAP) {
count = ath11k_mac_copy_he_cap(ar, cap,
@@ -3529,6 +3529,7 @@ static void ath11k_mac_setup_he_cap(struct ath11k *ar,
NL80211_BAND_2GHZ);
band = &ar->mac.sbands[NL80211_BAND_2GHZ];
band->iftype_data = ar->mac.iftype[NL80211_BAND_2GHZ];
+ band->n_iftype_data = count;
}
if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP) {
@@ -3537,9 +3538,8 @@ static void ath11k_mac_setup_he_cap(struct ath11k *ar,
NL80211_BAND_5GHZ);
band = &ar->mac.sbands[NL80211_BAND_5GHZ];
band->iftype_data = ar->mac.iftype[NL80211_BAND_5GHZ];
+ band->n_iftype_data = count;
}
-
- band->n_iftype_data = count;
}
static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant)
--
2.24.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH][next] ath11k: avoid null pointer dereference when pointer band is null
2020-01-11 9:08 Colin King
@ 2020-01-26 10:48 ` Kalle Valo
0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2020-01-26 10:48 UTC (permalink / raw)
To: Colin King
Cc: David S . Miller, John Crispin, Shashidhar Lakkavalli, ath11k,
linux-wireless, netdev, kernel-janitors, linux-kernel
Colin King <colin.king@canonical.com> wrote:
> In the unlikely event that cap->supported_bands has neither
> WMI_HOST_WLAN_2G_CAP set or WMI_HOST_WLAN_5G_CAP set then pointer
> band is null and a null dereference occurs when assigning
> band->n_iftype_data. Move the assignment to the if blocks to
> avoid this. Cleans up static analysis warnings.
>
> Addresses-Coverity: ("Explicit null dereference")
> Fixes: 9f056ed8ee01 ("ath11k: add HE support")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
3b4516838eaa ath11k: avoid null pointer dereference when pointer band is null
--
https://patchwork.kernel.org/patch/11328755/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-01-26 10:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-11 9:50 [PATCH][next] ath11k: avoid null pointer dereference when pointer band is null linmiaohe
[not found] ` <64797126-0c77-4c2c-ad2b-29d7af452c13@wanadoo.fr>
2020-01-11 11:57 ` Marion & Christophe JAILLET
2020-01-13 8:47 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-01-11 9:08 Colin King
2020-01-26 10:48 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox