From: Kumar Amit Mehta Date: Mon, 26 Jan 2015 15:39:14 +0000 (+0100) Subject: staging: rtl8188eu: core: rtw_wlan_util.c: Fix for NULL dereference X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=0137f1a019952f955f4050495be6725a5f92eb5b;p=openwrt%2Fstaging%2Fblogic.git staging: rtl8188eu: core: rtw_wlan_util.c: Fix for NULL dereference In rtw_check_bcn_info(), check the return value of kzalloc() before dereferencing it, to avoid NULL pointer dereference. Signed-off-by: Kumar Amit Mehta Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index 3e9b6e932641..a3ffc691be9a 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -931,6 +931,8 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); + if (!bssid) + return _FAIL; subtype = GetFrameSubType(pframe) >> 4;