staging: rtl8723bs: avoid null pointer dereference on pmlmepriv
authorColin Ian King <colin.king@canonical.com>
Wed, 20 Sep 2017 17:34:18 +0000 (18:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 Sep 2017 09:00:58 +0000 (11:00 +0200)
commitec14121931a24f8d3678b8a9c408adee3b21d465
treee6c67c5fd129ce9f7ae7d1f28ecf6dec2b854a3d
parentc51b46dd5b9950436b6b1f8189e93e1ad380cee1
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: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme.c