From: Pavel Skripkin <paskripkin@gmail.com>
To: Vihas Makwana <makvihas@gmail.com>,
Larry Finger <Larry.Finger@lwfinger.net>,
Phillip Potter <phil@philpotter.co.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Straube <straube.linux@gmail.com>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 1/3] staging: r8188eu: fix null check in rtw_free_recvframe
Date: Sun, 24 Apr 2022 22:01:29 +0300 [thread overview]
Message-ID: <88d617e4-419c-0d57-b0e2-f743d208c766@gmail.com> (raw)
In-Reply-To: <20220424163132.37007-2-makvihas@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2022-04-24 19:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 16:31 [PATCH 0/3] staging: r8188eu: fix some null checks Vihas Makwana
2022-04-24 16:31 ` [PATCH 1/3] staging: r8188eu: fix null check in rtw_free_recvframe Vihas Makwana
2022-04-24 19:01 ` Pavel Skripkin [this message]
2022-04-24 16:31 ` [PATCH 2/3] staging: r8188eu: fix null check in _rtw_enqueue_recvframe Vihas Makwana
2022-04-24 18:53 ` Pavel Skripkin
2022-04-25 17:47 ` Vihas Makwana
2022-04-24 16:31 ` [PATCH 3/3] staging: r8188eu: fix null check in _rtw_free_mlme_priv Vihas Makwana
2022-04-24 19:00 ` Pavel Skripkin
2022-04-25 17:55 ` Vihas Makwana
2022-04-25 18:48 ` Dan Carpenter
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=88d617e4-419c-0d57-b0e2-f743d208c766@gmail.com \
--to=paskripkin@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=makvihas@gmail.com \
--cc=phil@philpotter.co.uk \
--cc=straube.linux@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;
as well as URLs for NNTP newsgroup(s).