mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8712: fix potential null pointer dereference
@ 2015-03-11 13:31 Matteo Semenzato
  0 siblings, 0 replies; only message in thread
From: Matteo Semenzato @ 2015-03-11 13:31 UTC (permalink / raw)
  To: gregkh, Larry.Finger, florian.c.schilhabel, shack, vitaly.osipov,
	peter.senna, vthakkar1994, cengelma, sudipm.mukherjee,
	tapaswenipathak
  Cc: devel, linux-kernel, Matteo Semenzato

From: Matteo Semenzato <mattew8898@gmail.com>

Check if kmalloc succeded before using the pointer in memcpy.

Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index 977a833..c6e9012 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -727,6 +727,8 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 
 	if (sizeof(struct list_head) == 4 * sizeof(u32)) {
 		pnetwork = kmalloc(sizeof(struct wlan_network), GFP_ATOMIC);
+		if (!pnetwork)
+			return;
 		memcpy((u8 *)pnetwork+16, (u8 *)pbuf + 8,
 			sizeof(struct wlan_network) - 16);
 	} else
-- 
2.3.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-11 13:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11 13:31 [PATCH] Staging: rtl8712: fix potential null pointer dereference Matteo Semenzato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®