Skip to contentSkip to conversation

staging: rtl8188eu: core: rtw_wlan_util.c: Fix for NULL dereference

PATCH In review Kumar Amit Mehta 2 participants 3 messages Jan 26, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +2 -0
index 3e9b6e9..a3ffc69 100644
@@ -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;
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 13 lines · Kumar Amit Mehta

In rtw_check_bcn_info(), check the return value of kzalloc() before dereferencing it, to avoid NULL pointer dereference.

---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +0 -0
index 3e9b6e9..a3ffc69 100644

drivers/staging/rtl8188eu/core/rtw_wlan_util.c int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) · line 935

Quoted 5 lines
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +2 -0
@@ -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;

I haven't looked at this issue in a while, but shouldn't this be OBD_ALLOC?

Although I still find macros parameters that are side effected to be unpleasant...

julia

Quoted 10 lines
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +0 -1
 	subtype = GetFrameSubType(pframe) >> 4;
 
--

2.1.0

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 17 lines · Julia Lawall
Quoted 15 lines · Kumar Amit Mehta

In rtw_check_bcn_info(), check the return value of kzalloc() before dereferencing it, to avoid NULL pointer dereference.

---
 drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +0 -0
index 3e9b6e9..a3ffc69 100644
@@ -931,6 +931,8 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 *pframe, u32 packet_len)
 	}
 
Quoted 6 lines

drivers/staging/rtl8188eu/core/rtw_wlan_util.c int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) · line 935

Quoted 3 lines
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +2 -0
 	bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
+	if (!bssid)
+		return _FAIL;

I haven't looked at this issue in a while, but shouldn't this be OBD_ALLOC?

Sorry for the noise. I assumed that both patches were for lustre, but this one is not.

julia