diff mbox series

wifi: ath12k: Avoid NULL pointer access during management transmit cleanup

Message ID 20230518071046.14337-1-quic_bselvara@quicinc.com
State New
Headers show
Series wifi: ath12k: Avoid NULL pointer access during management transmit cleanup | expand

Commit Message

Balamurugan S May 18, 2023, 7:10 a.m. UTC
Currently 'ar' reference is not added in skb_cb.
Though this is generally not used during transmit completion
callbacks, on interface removal the remaining idr cleanup callback
uses the ar pointer from skb_cb from management txmgmt_idr. Hence fill them
during transmit call for proper usage to avoid NULL pointer dereference.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Balamurugan S <quic_bselvara@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/mac.c | 1 +
 1 file changed, 1 insertion(+)


base-commit: 610b78b97bad8f3e77c27a15e9a03cbbb4109697

Comments

Vasanthakumar Thiagarajan May 18, 2023, 7:16 a.m. UTC | #1
On 5/18/2023 12:40 PM, Balamurugan S wrote:
> Currently 'ar' reference is not added in skb_cb.
> Though this is generally not used during transmit completion
> callbacks, on interface removal the remaining idr cleanup callback
> uses the ar pointer from skb_cb from management txmgmt_idr. Hence fill them
> during transmit call for proper usage to avoid NULL pointer dereference.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Balamurugan S <quic_bselvara@quicinc.com>
> ---
>   drivers/net/wireless/ath/ath12k/mac.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index d814d74bc168..a344211f5b53 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -4443,6 +4443,7 @@ static int ath12k_mac_mgmt_tx_wmi(struct ath12k *ar, struct ath12k_vif *arvif,
>   	int buf_id;
>   	int ret;
>   
> +	ATH12K_SKB_CB(skb)->ar = ar;
>   	spin_lock_bh(&ar->txmgmt_idr_lock);
>   	buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0,
>   			   ATH12K_TX_MGMT_NUM_PENDING_MAX, GFP_ATOMIC);
> 
> base-commit: 610b78b97bad8f3e77c27a15e9a03cbbb4109697

LGTM
Kalle Valo June 9, 2023, 1:32 p.m. UTC | #2
Balamurugan S <quic_bselvara@quicinc.com> wrote:

> Currently 'ar' reference is not added in skb_cb.
> Though this is generally not used during transmit completion
> callbacks, on interface removal the remaining idr cleanup callback
> uses the ar pointer from skb_cb from management txmgmt_idr. Hence fill them
> during transmit call for proper usage to avoid NULL pointer dereference.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Balamurugan S <quic_bselvara@quicinc.com>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

054b5580a36e wifi: ath12k: Avoid NULL pointer access during management transmit cleanup
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index d814d74bc168..a344211f5b53 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -4443,6 +4443,7 @@  static int ath12k_mac_mgmt_tx_wmi(struct ath12k *ar, struct ath12k_vif *arvif,
 	int buf_id;
 	int ret;
 
+	ATH12K_SKB_CB(skb)->ar = ar;
 	spin_lock_bh(&ar->txmgmt_idr_lock);
 	buf_id = idr_alloc(&ar->txmgmt_idr, skb, 0,
 			   ATH12K_TX_MGMT_NUM_PENDING_MAX, GFP_ATOMIC);