From: colin.king@canonical.com (Colin King)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service'
Date: Mon, 20 Mar 2017 14:08:50 +0000 [thread overview]
Message-ID: <20170320140850.10570-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
Currently, if pservice is null then service is set to NULL and immediately
afterwards service is dereferenced causing a null pointer dereference. Fix
this by bailing out early of the function with a null return.
Detected by CoverityScan, CID#1419681 ("Explicit null dereferenced")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index dc9f85c2a5da..4f9e738abddf 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -2673,7 +2673,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
if (!pservice) {
kfree(service);
- service = NULL;
+ return NULL;
}
service_quota = &state->service_quotas[service->localport];
--
2.11.0
next reply other threads:[~2017-03-20 14:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 14:08 Colin King [this message]
2017-03-20 14:26 ` [PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service' Stefan Wahren
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=20170320140850.10570-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).