From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Connor Kuehl <connor.kuehl@canonical.com>,
Larry Finger <Larry.Finger@lwfinger.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sasha Levin <sashal@kernel.org>,
devel@driverdev.osuosl.org
Subject: [PATCH AUTOSEL 5.3 018/292] staging: rtl8188eu: fix possible null dereference
Date: Tue, 10 Dec 2019 16:20:37 -0500 [thread overview]
Message-ID: <20191210212511.11392-18-sashal@kernel.org> (raw)
In-Reply-To: <20191210212511.11392-1-sashal@kernel.org>
From: Connor Kuehl <connor.kuehl@canonical.com>
[ Upstream commit 228241944a48113470d3c3b46c88ba7fbe0a274b ]
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>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Link: https://lore.kernel.org/r/20190926150317.5894-1-connor.kuehl@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 952f2ab513478..c37591657bac4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -776,7 +776,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattr
memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv), ETH_ALEN);
memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
- if (psta->qos_option)
+ if (psta && psta->qos_option)
qos_option = true;
} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
@@ -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)));
--
2.20.1
next prev parent reply other threads:[~2019-12-10 21:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 21:20 [PATCH AUTOSEL 5.3 001/292] drm/vc4/vc4_hdmi: fill in connector info Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 002/292] drm: mst: Fix query_payload ack reply struct Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 003/292] drm/mipi-dbi: fix a loop in debugfs code Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 004/292] drm/panel: Add missing drm_panel_init() in panel drivers Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 005/292] drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 006/292] drm/amd/display: verify stream link before link test Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 007/292] drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 008/292] iio: max31856: add missing of_node and parent references to iio_dev Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 009/292] iio: light: bh1750: Resolve compiler warning and make code more readable Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 010/292] drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 011/292] drm/amdgpu: grab the id mgr lock while accessing passid_mapping Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 012/292] ath10k: add cleanup in ath10k_sta_state() Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 013/292] drm/amd/display: Handle virtual signal type in disable_link() Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 014/292] iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 015/292] ath10k: Check if station exists before forwarding tx airtime report Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 016/292] spi: Add call to spi_slave_abort() function when spidev driver is released Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 017/292] staging: rtl8192u: fix multiple memory leaks on error path Sasha Levin
2019-12-10 21:20 ` Sasha Levin [this message]
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 019/292] objtool: add kunit_try_catch_throw to the noreturn list Sasha Levin
2019-12-10 21:31 ` Brendan Higgins
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 020/292] rtlwifi: prevent memory leak in rtl_usb_probe Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 021/292] libertas: fix a potential NULL pointer dereference Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 022/292] Revert "pinctrl: sh-pfc: r8a77990: Fix MOD_SEL1 bit30 when using SSI_SCK2 and SSI_WS2" Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 023/292] Revert "pinctrl: sh-pfc: r8a77990: Fix MOD_SEL1 bit31 when using SIM0_D" Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 024/292] ath10k: fix backtrace on coredump Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 025/292] IB/iser: bound protection_sg size by data_sg size Sasha Levin
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=20191210212511.11392-18-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Larry.Finger@lwfinger.net \
--cc=connor.kuehl@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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