lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1444194505-31080-1-git-send-email-vincent.stehle@laposte.net>
Date:	Wed,  7 Oct 2015 07:08:25 +0200
From:	Vincent Stehlé <vincent.stehle@...oste.net>
To:	devel@...verdev.osuosl.org
Cc:	linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
	Vincent Stehlé <vincent.stehle@...oste.net>,
	Johnny Kim <johnny.kim@...el.com>,
	Rachel Kim <rachel.kim@...el.com>,
	Dean Lee <dean.lee@...el.com>,
	Chris Park <chris.park@...el.com>,
	Nicolas Ferre <nicolas.ferre@...el.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH next] staging: wilc1000: avoid NULL pointer dereference on error

The host_int_init() function can dereference the pstrWFIDrv pointer
while it is NULL on its error path. Jump directly to the _fail_ error
label in the end of the error handling path to avoid that.
	By doing that we also skip stopping our kthread and destroying
our message queue, but they were not started or created yet in that case
anyway.

This fixes the following coccinelle error:

  drivers/staging/wilc1000/host_interface.c:6100:17-33: ERROR: pstrWFIDrv is NULL but dereferenced.

Signed-off-by: Vincent Stehlé <vincent.stehle@...oste.net>
Cc: Johnny Kim <johnny.kim@...el.com>
Cc: Rachel Kim <rachel.kim@...el.com>
Cc: Dean Lee <dean.lee@...el.com>
Cc: Chris Park <chris.park@...el.com>
Cc: Nicolas Ferre <nicolas.ferre@...el.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---


Hi,

Another form of this patch would make sense on mainline as well, but the
driver has changed so much in the mean time that it makes more sense to
modify staging-next.

Best regards,

V.


 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 2cf82b2..2fe3023 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6017,7 +6017,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
 	pstrWFIDrv  = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
 	if (!pstrWFIDrv) {
 		result = -ENOMEM;
-		goto _fail_timer_2;
+		goto _fail_;
 	}
 	*phWFIDrv = pstrWFIDrv;
 	err = add_handler_in_list(pstrWFIDrv);
-- 
2.5.1

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ