From: Matteo Semenzato <mattew8898@gmail.com>
To: gregkh@linuxfoundation.org, Larry.Finger@lwfinger.net,
florian.c.schilhabel@googlemail.com, shack@linux.com,
vitaly.osipov@gmail.com, peter.senna@gmail.com,
vthakkar1994@gmail.com, cengelma@gmx.at,
sudipm.mukherjee@gmail.com, tapaswenipathak@gmail.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Matteo Semenzato <mattew8898@gmail.com>
Subject: [PATCH] Staging: rtl8712: fix potential null pointer dereference
Date: Wed, 11 Mar 2015 14:31:14 +0100 [thread overview]
Message-ID: <1426080674-2075-1-git-send-email-mattew8898@gmail.com> (raw)
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
reply other threads:[~2015-03-11 13:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426080674-2075-1-git-send-email-mattew8898@gmail.com \
--to=mattew8898@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=cengelma@gmx.at \
--cc=devel@driverdev.osuosl.org \
--cc=florian.c.schilhabel@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.senna@gmail.com \
--cc=shack@linux.com \
--cc=sudipm.mukherjee@gmail.com \
--cc=tapaswenipathak@gmail.com \
--cc=vitaly.osipov@gmail.com \
--cc=vthakkar1994@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®