mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasanthakumar Thiagarajan <quic_vthiagar@quicinc.com>
To: Baichuan Qi <zghbqbc@gmail.com>, <markus.elfring@web.de>
Cc: <ath11k@lists.infradead.org>, <jjohnson@kernel.org>,
	<kvalo@kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-wireless@vger.kernel.org>
Subject: Re: [PATCH v5] wifi: ath11k: Fix NULL pointer check in ath11k_ce_rx_post_pipe()
Date: Wed, 27 Nov 2024 20:53:07 +0530	[thread overview]
Message-ID: <f0077f4f-922d-56b1-a5b7-bb01e4462e87@quicinc.com> (raw)
In-Reply-To: <20241127143804.30075-1-zghbqbc@gmail.com>



On 11/27/2024 8:08 PM, Baichuan Qi wrote:
> Current implementation of `ath11k_ce_rx_post_pipe()` checks for
> NON-NULL of either `dest_ring` or `status_ring` using an OR (||).
> Both rings, especially `dest_ring`, should be ensured to be
> NON-NULL in this function.
> 
> If only one of the rings is valid, such as `dest_ring` is NULL
> and `status_ring` is NON-NULL, the OR (||) check would not stop
> `ath11k_ce_rx_post_pipe()`, the subsequent call to
> `ath11k_ce_rx_buf_enqueue_pipe()` will access the NULL pointer,
> resulting in a driver crash.
> 
> Fix the NON-NULL check by changing the OR (||) to AND (&&),
> and return an error code `-EIO` to indicate
> `ath11k_ce_rx_post_pipe()` is stopped with an NULL pointer
> error, ensuring that the function only proceeds when both
> `dest_ring` and `status_ring` are NON-NULL.
> 
> Link: https://lore.kernel.org/ath11k/a9ccc947-20b2-4322-84e5-c96aaa604e63@web.de
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")

This does not really fix any real issue. Please check ath11k_ce_alloc_pipe()
where initialization would fail if anyone of pipe->dest_ring and
pipe->status_ring allocation fails for ce pipe used for Rx.

> Signed-off-by: Baichuan Qi <zghbqbc@gmail.com>
> ---
> V4 -> V5: add err code in NULL check
> V3 -> V4: reorder describe info
> V2 -> V3: add Link URL to mailing list archives
> V1 -> V2: rewrite commit message and fix tag
> 
>   drivers/net/wireless/ath/ath11k/ce.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath11k/ce.c b/drivers/net/wireless/ath/ath11k/ce.c
> index e66e86bdec20..223dab928453 100644
> --- a/drivers/net/wireless/ath/ath11k/ce.c
> +++ b/drivers/net/wireless/ath/ath11k/ce.c
> @@ -324,8 +324,10 @@ 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))
> -		return 0;
> +	if (!(pipe->dest_ring && pipe->status_ring)) {
> +		ret = -EIO;
> +		return ret;
> +	}

This will always fail as the caller loops through all the supported ce pipes
and ce pipes used for Tx will not have either dest_ring or status_ring.
Please ensure the patch is tested properly.

So NAK

Vasanth

  reply	other threads:[~2024-11-27 15:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25  5:08 [PATCH] " Baichuan Qi
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f0077f4f-922d-56b1-a5b7-bb01e4462e87@quicinc.com \
    --to=quic_vthiagar@quicinc.com \
    --cc=ath11k@lists.infradead.org \
    --cc=jjohnson@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=markus.elfring@web.de \
    --cc=zghbqbc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®