netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: rtl8192c: fix a potential NULL pointer dereference
@ 2019-03-12  7:59 Kangjie Lu
  2019-03-12  9:03 ` Pkshih
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-12  7:59 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Ping-Ke Shih, Kalle Valo, David S. Miller, Larry Finger,
	Andrew Morton, Ingo Molnar, Randy Dunlap, linux-wireless, netdev,
	linux-kernel

In case dev_alloc_skb fails, the fix safely returns to avoid
potential NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
index 18c76990a089..9042fc044c7e 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c
@@ -623,6 +623,9 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw,
 		      u1rsvdpageloc, 3);
 
 	skb = dev_alloc_skb(totalpacketlen);
+	if (!skb)
+		return;
+
 	skb_put_data(skb, &reserved_page_packet, totalpacketlen);
 
 	if (cmd_send_packet)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-12  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-12  7:59 [PATCH] net: rtl8192c: fix a potential NULL pointer dereference Kangjie Lu
2019-03-12  9:03 ` Pkshih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).