[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1426080674-2075-1-git-send-email-mattew8898@gmail.com>
Date: Wed, 11 Mar 2015 14:31:14 +0100
From: Matteo Semenzato <mattew8898@...il.com>
To: gregkh@...uxfoundation.org, Larry.Finger@...inger.net,
florian.c.schilhabel@...glemail.com, shack@...ux.com,
vitaly.osipov@...il.com, peter.senna@...il.com,
vthakkar1994@...il.com, cengelma@....at,
sudipm.mukherjee@...il.com, tapaswenipathak@...il.com
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Matteo Semenzato <mattew8898@...il.com>
Subject: [PATCH] Staging: rtl8712: fix potential null pointer dereference
From: Matteo Semenzato <mattew8898@...il.com>
Check if kmalloc succeded before using the pointer in memcpy.
Signed-off-by: Matteo Semenzato <mattew8898@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists