Commit ec141219 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

staging: rtl8723bs: avoid null pointer dereference on pmlmepriv

There is a check to see if pmlmepriv is null before vfree'ing
pmlmepriv->free_bss_buf hence implying pmlmepriv could potenially be
null. However, a previous call to rtw_free_mlme_priv_ie_data
can also dereference pmlmepriv, so move this call so that it is only
called if pmlmepriv non-null.

Detected by CoverityScan, CID#1077739 ("Dereference before null check")

Fixes: 554c0a3a ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c51b46dd
......@@ -119,9 +119,8 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv)
void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv)
{
rtw_free_mlme_priv_ie_data(pmlmepriv);
if (pmlmepriv) {
rtw_free_mlme_priv_ie_data(pmlmepriv);
if (pmlmepriv->free_bss_buf) {
vfree(pmlmepriv->free_bss_buf);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment