From: Larry Finger <Larry.Finger@lwfinger.net>
To: Connor Kuehl <connor.kuehl@canonical.com>,
gregkh@linuxfoundation.org, straube.linux@gmail.com,
devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8188eu: fix possible null dereference
Date: Wed, 25 Sep 2019 19:05:40 -0500 [thread overview]
Message-ID: <b725820f-525c-519b-4474-476abf004985@lwfinger.net> (raw)
In-Reply-To: <20190925213215.25082-1-connor.kuehl@canonical.com>
On 9/25/19 4:32 PM, Connor Kuehl wrote:
> Inside a nested 'else' block at the beginning of this function is a
> call that assigns 'psta' to the return value of 'rtw_get_stainfo()'.
> If 'rtw_get_stainfo()' returns NULL and the flow of control reaches
> the 'else if' where 'psta' is dereferenced, then we will dereference
> a NULL pointer.
>
> Fix this by checking if 'psta' is not NULL before reading its
> 'psta->qos_option' data member.
>
> Addresses-Coverity: ("Dereference null return value")
>
> Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_xmit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> index 952f2ab51347..bf8877cbe9b6 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> @@ -784,7 +784,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
> memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
> memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv), ETH_ALEN);
>
> - if (psta->qos_option)
> + if (psta && psta->qos_option)
> qos_option = true;
> } else {
> RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x is not allowed to xmit frame\n", get_fwstate(pmlmepriv)));
>
This change is a good one, but why not get the same fix at line 779?
Larry
next prev parent reply other threads:[~2019-09-26 0:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 21:32 [PATCH] staging: rtl8188eu: fix possible null dereference Connor Kuehl
2019-09-26 0:05 ` Larry Finger [this message]
2019-09-26 15:01 ` Connor Kuehl
-- strict thread matches above, loose matches on Subject: below --
2015-08-14 16:27 [PATCH] staging: rtl8188eu: fix possible NULL dereference Sudip Mukherjee
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=b725820f-525c-519b-4474-476abf004985@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=connor.kuehl@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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).