All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath11k: Fix pointer dereferenced before checking
@ 2022-05-16  3:23 ` Haowen Bai
  0 siblings, 0 replies; 4+ messages in thread
From: Haowen Bai @ 2022-05-16  3:23 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Haowen Bai, ath11k, linux-wireless, netdev, linux-kernel

The pointer sspec is dereferencing pointer sar before sar is being
null checked. Fix this by assigning sar->sub_specs to sspec only if
sar is not NULL, otherwise just NULL. The code has checked sar whether
it is NULL or not as below, but use before checking.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 1957e1713548..fe97c9a3c1c5 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8287,7 +8287,7 @@ static int ath11k_mac_op_set_bios_sar_specs(struct ieee80211_hw *hw,
 					    const struct cfg80211_sar_specs *sar)
 {
 	struct ath11k *ar = hw->priv;
-	const struct cfg80211_sar_sub_specs *sspec = sar->sub_specs;
+	const struct cfg80211_sar_sub_specs *sspec = sar ? sar->sub_specs : NULL;
 	int ret, index;
 	u8 *sar_tbl;
 	u32 i;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ath11k: Fix pointer dereferenced before checking
@ 2022-05-16  3:23 ` Haowen Bai
  0 siblings, 0 replies; 4+ messages in thread
From: Haowen Bai @ 2022-05-16  3:23 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Haowen Bai, ath11k, linux-wireless, netdev, linux-kernel

The pointer sspec is dereferencing pointer sar before sar is being
null checked. Fix this by assigning sar->sub_specs to sspec only if
sar is not NULL, otherwise just NULL. The code has checked sar whether
it is NULL or not as below, but use before checking.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/net/wireless/ath/ath11k/mac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 1957e1713548..fe97c9a3c1c5 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8287,7 +8287,7 @@ static int ath11k_mac_op_set_bios_sar_specs(struct ieee80211_hw *hw,
 					    const struct cfg80211_sar_specs *sar)
 {
 	struct ath11k *ar = hw->priv;
-	const struct cfg80211_sar_sub_specs *sspec = sar->sub_specs;
+	const struct cfg80211_sar_sub_specs *sspec = sar ? sar->sub_specs : NULL;
 	int ret, index;
 	u8 *sar_tbl;
 	u32 i;
-- 
2.7.4


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath11k: Fix pointer dereferenced before checking
  2022-05-16  3:23 ` Haowen Bai
@ 2022-05-18  7:21   ` Kalle Valo
  -1 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2022-05-18  7:21 UTC (permalink / raw)
  To: Haowen Bai
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Haowen Bai, ath11k, linux-wireless, netdev, linux-kernel

Haowen Bai <baihaowen@meizu.com> wrote:

> The pointer sspec is dereferencing pointer sar before sar is being
> null checked. Fix this by assigning sar->sub_specs to sspec only if
> sar is not NULL, otherwise just NULL. The code has checked sar whether
> it is NULL or not as below, but use before checking.
> 
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>

I prefer Baochen's version:

https://patchwork.kernel.org/project/linux-wireless/patch/20220517004844.2412660-1-quic_bqiang@quicinc.com/

Patch set to Superseded.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1652671437-20235-1-git-send-email-baihaowen@meizu.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ath11k: Fix pointer dereferenced before checking
@ 2022-05-18  7:21   ` Kalle Valo
  0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2022-05-18  7:21 UTC (permalink / raw)
  To: Haowen Bai
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Haowen Bai, ath11k, linux-wireless, netdev, linux-kernel

Haowen Bai <baihaowen@meizu.com> wrote:

> The pointer sspec is dereferencing pointer sar before sar is being
> null checked. Fix this by assigning sar->sub_specs to sspec only if
> sar is not NULL, otherwise just NULL. The code has checked sar whether
> it is NULL or not as below, but use before checking.
> 
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>

I prefer Baochen's version:

https://patchwork.kernel.org/project/linux-wireless/patch/20220517004844.2412660-1-quic_bqiang@quicinc.com/

Patch set to Superseded.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1652671437-20235-1-git-send-email-baihaowen@meizu.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


-- 
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-18  7:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  3:23 [PATCH] ath11k: Fix pointer dereferenced before checking Haowen Bai
2022-05-16  3:23 ` Haowen Bai
2022-05-18  7:21 ` Kalle Valo
2022-05-18  7:21   ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.