All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: ath11k: Fix NULL pointer check in ath11k_ce_rx_post_pipe()
@ 2024-11-25  5:08 Baichuan Qi
  2024-11-25  5:33 ` Mihai Moldovan
  2024-11-25 10:34 ` Markus Elfring
  0 siblings, 2 replies; 20+ messages in thread
From: Baichuan Qi @ 2024-11-25  5:08 UTC (permalink / raw)
  To: kvalo; +Cc: jjohnson, linux-wireless, ath11k, linux-kernel, Baichuan Qi

The previous code used OR for NULL pointer check, whitch can not
guarantee the pipe->dest_ring pointer is NON-NULL. When certain
errors occur, causing pipe->dest_ring to be NULL while
pipe->status_ring remains NON-NULL, the subsequent call to
ath11k_ce_rx_buf_enqueue_pipe() will access the NULL pointer,
resulting in a driver crash.
If it is assumed that these two pointers will not become NULL
for any reason, then only need to check pipe->dest_ring is or
not a NULL pointer, and no need to check NULL pointer on
pipe->status_ring.

Signed-off-by: Baichuan Qi <zghbqbc@gmail.com>
---
 drivers/net/wireless/ath/ath11k/ce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c
index e66e86bdec20..cc9ad014d800 100644
--- a/drivers/net/wireless/ath/ath11k/ce.c
+++ b/drivers/net/wireless/ath/ath11k/ce.c
@@ -324,7 +324,7 @@ static int ath11k_ce_rx_post_pipe(struct ath11k_ce_pipe *pipe)
 	dma_addr_t paddr;
 	int ret = 0;
 
-	if (!(pipe->dest_ring || pipe->status_ring))
+	if (!(pipe->dest_ring && pipe->status_ring))
 		return 0;
 
 	spin_lock_bh(&ab->ce.ce_lock);
-- 
2.34.1



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

end of thread, other threads:[~2024-11-28  6:09 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-25  5:08 [PATCH] wifi: ath11k: Fix NULL pointer check in ath11k_ce_rx_post_pipe() Baichuan Qi
2024-11-25  5:33 ` Mihai Moldovan
2024-11-25  7:37   ` Baichuan Qi
2024-11-25 22:23     ` Mihai Moldovan
2024-11-25 10:34 ` Markus Elfring
2024-11-26  2:33   ` Baichuan Qi
2024-11-26 13:44     ` Markus Elfring
2024-11-27  3:28       ` zgBCQ
2024-11-27 12:40         ` Markus Elfring
2024-11-27 14:35           ` Re: wifi: ath11k: Fix NULL pointer check in ath11k_ce_rx_post_pipe() ERROR code Baichuan Qi
2024-11-27 14:38           ` [PATCH v5] wifi: ath11k: Fix NULL pointer check in ath11k_ce_rx_post_pipe() Baichuan Qi
2024-11-27 15:23             ` Vasanthakumar Thiagarajan
2024-11-28  6:09               ` Re: [PATCH v5] NAK Baichuan Qi
2024-11-27  3:32       ` [PATCH v2 1/1] wifi: ath11k: Fix NULL pointer check in ath11k_ce_rx_post_pipe() Baichuan Qi
2024-11-27  9:05         ` [PATCH v4?] " Markus Elfring
2024-11-27  9:43           ` [PATCH v3] " Baichuan Qi
2024-11-27 10:30             ` Kang Yang
2024-11-27 12:00               ` Baichuan Qi
2024-11-27 10:36             ` [PATCH v4?] " Markus Elfring
2024-11-27 11:43               ` [PATCH v4] " Baichuan Qi

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.