[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88d617e4-419c-0d57-b0e2-f743d208c766@gmail.com>
Date: Sun, 24 Apr 2022 22:01:29 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: Vihas Makwana <makvihas@...il.com>,
Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Michael Straube <straube.linux@...il.com>
Cc: linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 1/3] staging: r8188eu: fix null check in
rtw_free_recvframe
Hi Vihas,
On 4/24/22 19:31, Vihas Makwana wrote:
> There's a NULL check on padapter in rtw_recv.c:170 which makes no sense as
> rtw_recv.c:152 dereferences it unconditionally and it would have already
> crashed at this point.
> Fix this by moving the dereference line inside the check.
>
> Signed-off-by: Vihas Makwana <makvihas@...il.com>
> ---
> drivers/staging/r8188eu/core/rtw_recv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> index c1005ddaa..4cf9b4b8f 100644
> --- a/drivers/staging/r8188eu/core/rtw_recv.c
> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> @@ -154,7 +154,6 @@ int rtw_free_recvframe(struct recv_frame *precvframe, struct __queue *pfree_recv
> if (!precvframe)
> return _FAIL;
> padapter = precvframe->adapter;
> - precvpriv = &padapter->recvpriv;
This expression just an addr calculation, so it does not lead to panic
in case of padapter being NULL
> if (precvframe->pkt) {
> dev_kfree_skb_any(precvframe->pkt);/* free skb by driver */
> precvframe->pkt = NULL;
> @@ -169,6 +168,7 @@ int rtw_free_recvframe(struct recv_frame *precvframe, struct __queue *pfree_recv
> list_add_tail(&precvframe->list, get_list_head(pfree_recv_queue));
>
> if (padapter) {
> + precvpriv = &padapter->recvpriv;
> if (pfree_recv_queue == &precvpriv->free_recv_queue)
> precvpriv->free_recvframe_cnt++;
> }
With regards,
Pavel Skripkin
Powered by blists - more mailing lists