lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <6658a046-9d4e-4f18-8405-f5dadcf410ee@web.de>
Date: Sat, 21 Sep 2024 16:43:20 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: ath11k@...ts.infradead.org, ath12k@...ts.infradead.org,
 linux-wireless@...r.kernel.org, Jeff Johnson <jjohnson@...nel.org>,
 Kalle Valo <kvalo@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Julia Lawall <julia.lawall@...ia.fr>
Subject: [PATCH] wifi: ath: Use dev_kfree_skb_any(skb) call only once in three
 functions

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 21 Sep 2024 16:32:09 +0200

A dev_kfree_skb_any(skb) call was immediately used after a return code
check in three function implementations.
Thus use such a function call only once instead directly before the checks.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/net/wireless/ath/ath11k/dp_rx.c  | 6 ++----
 drivers/net/wireless/ath/ath12k/dp_mon.c | 4 +---
 drivers/net/wireless/ath/ath12k/dp_rx.c  | 6 ++----
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index c087d8a0f5b2..eb8e5fbdd77a 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -1808,11 +1808,9 @@ static int ath11k_dp_rx_msdu_coalesce(struct ath11k *ar,
 		/* Free up all buffers of the MSDU */
 		while ((skb = __skb_dequeue(msdu_list)) != NULL) {
 			rxcb = ATH11K_SKB_RXCB(skb);
-			if (!rxcb->is_continuation) {
-				dev_kfree_skb_any(skb);
-				break;
-			}
 			dev_kfree_skb_any(skb);
+			if (!rxcb->is_continuation)
+				break;
 		}
 		return -ENOMEM;
 	}
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 5c6749bc4039..21780f06b4ae 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -2102,16 +2102,14 @@ int ath12k_dp_mon_srng_process(struct ath12k *ar, int mac_id, int *budget,
 								  skb, napi, ppdu_id);

 			peer = ath12k_peer_find_by_id(ab, ppdu_info->peer_id);
-
+			dev_kfree_skb_any(skb);
 			if (!peer || !peer->sta) {
 				ath12k_dbg(ab, ATH12K_DBG_DATA,
 					   "failed to find the peer with peer_id %d\n",
 					   ppdu_info->peer_id);
-				dev_kfree_skb_any(skb);
 				continue;
 			}

-			dev_kfree_skb_any(skb);
 			pmon->dest_skb_q[i] = NULL;
 		}

diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
index 91e3393f7b5f..c0b59ac247bf 100644
--- a/drivers/net/wireless/ath/ath12k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
@@ -1804,11 +1804,9 @@ static int ath12k_dp_rx_msdu_coalesce(struct ath12k *ar,
 		/* Free up all buffers of the MSDU */
 		while ((skb = __skb_dequeue(msdu_list)) != NULL) {
 			rxcb = ATH12K_SKB_RXCB(skb);
-			if (!rxcb->is_continuation) {
-				dev_kfree_skb_any(skb);
-				break;
-			}
 			dev_kfree_skb_any(skb);
+			if (!rxcb->is_continuation)
+				break;
 		}
 		return -ENOMEM;
 	}
--
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ