Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604623 > unrolled thread

[PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service'

Started byColin King <colin.king@canonical.com>
First post2017-03-20 15:30 +0100
Last post2017-03-20 15:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service' Colin King <colin.king@canonical.com> - 2017-03-20 15:30 +0100
    Re: [PATCH] staging: vc04_services: fix NULL pointer dereference on  pointer 'service' Stefan Wahren <stefan.wahren@i2se.com> - 2017-03-20 15:50 +0100

#1604623 — [PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service'

FromColin King <colin.king@canonical.com>
Date2017-03-20 15:30 +0100
Subject[PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service'
Message-ID<tn6tP-5Wi-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1604651 — Re: [PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service'

FromStefan Wahren <stefan.wahren@i2se.com>
Date2017-03-20 15:50 +0100
SubjectRe: [PATCH] staging: vc04_services: fix NULL pointer dereference on pointer 'service'
Message-ID<tn6Nb-67a-9@gated-at.bofh.it>
In reply to#1604623
[add Mauro to CC]

Am 20.03.2017 um 15:08 schrieb Colin King:
> 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>

Acked-by: Stefan Wahren <stefan.wahren@i2se.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web