From: Kangjie Lu <kjlu@umn.edu>
To: kjlu@umn.edu
Cc: pakki001@umn.edu, "Eric Anholt" <eric@anholt.net>,
"Stefan Wahren" <stefan.wahren@i2se.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Dominic Braun" <inf.braun@fau.de>,
"Tobias Büttner" <tobias.buettner@fau.de>,
"Nicolas Saenz Julienne" <nsaenzjulienne@suse.de>,
"Phil Elwell" <phil@raspberrypi.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] vc04_services: vchiq_arm: fix a NULL pointer dereference
Date: Sun, 24 Mar 2019 17:43:30 -0500 [thread overview]
Message-ID: <20190324224331.1163-1-kjlu@umn.edu> (raw)
When kzalloc fails, "platform_state->inited = 1" is a NULL pointer
dereference. The fix returns VCHIQ_ERROR in case it failed to
avoid NULL pointer dereference.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
.../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index dd4898861b83..0f12fe617575 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -209,6 +209,8 @@ vchiq_platform_init_state(struct vchiq_state *state)
struct vchiq_2835_state *platform_state;
state->platform_state = kzalloc(sizeof(*platform_state), GFP_KERNEL);
+ if (!state->platform_state)
+ return VCHIQ_ERROR;
platform_state = (struct vchiq_2835_state *)state->platform_state;
platform_state->inited = 1;
--
2.17.1
next reply other threads:[~2019-03-24 22:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-24 22:43 Kangjie Lu [this message]
2019-03-25 9:15 ` Stefan Wahren
2019-03-27 14:49 ` Mukesh Ojha
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=20190324224331.1163-1-kjlu@umn.edu \
--to=kjlu@umn.edu \
--cc=devel@driverdev.osuosl.org \
--cc=eric@anholt.net \
--cc=gregkh@linuxfoundation.org \
--cc=inf.braun@fau.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mcgrof@kernel.org \
--cc=nsaenzjulienne@suse.de \
--cc=pakki001@umn.edu \
--cc=phil@raspberrypi.org \
--cc=stefan.wahren@i2se.com \
--cc=tobias.buettner@fau.de \
/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®