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>] [day] [month] [year] [list]
Message-Id: <1279296889-25063-1-git-send-email-segooon@gmail.com>
Date:	Fri, 16 Jul 2010 20:14:49 +0400
From:	Kulikov Vasiliy <segooon@...il.com>
To:	kernel-janitors@...r.kernel.org
Cc:	Greg Kroah-Hartman <gregkh@...e.de>,
	Mauro Carvalho Chehab <mchehab@...hat.com>,
	Stefan Ringel <stefan.ringel@...or.de>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH 08/15] staging: tm6000: fix null dereference and memory leak

Do not dereference ir_input_dev if it is NULL.

Also free ir_input_dev->input_dev on error path.

Signed-off-by: Kulikov Vasiliy <segooon@...il.com>
---
 drivers/staging/tm6000/tm6000-input.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/tm6000/tm6000-input.c b/drivers/staging/tm6000/tm6000-input.c
index 32f7a0a..5edf728 100644
--- a/drivers/staging/tm6000/tm6000-input.c
+++ b/drivers/staging/tm6000/tm6000-input.c
@@ -247,8 +247,10 @@ int tm6000_ir_init(struct tm6000_core *dev)
 
 	ir = kzalloc(sizeof(*ir), GFP_KERNEL);
 	ir_input_dev = kzalloc(sizeof(*ir_input_dev), GFP_KERNEL);
+	if (!ir || !ir_input_dev)
+		goto err_out_free;
 	ir_input_dev->input_dev = input_allocate_device();
-	if (!ir || !ir_input_dev || !ir_input_dev->input_dev)
+	if (!ir_input_dev->input_dev)
 		goto err_out_free;
 
 	/* record handles to ourself */
@@ -330,6 +332,8 @@ int tm6000_ir_init(struct tm6000_core *dev)
 err_out_stop:
 	dev->ir = NULL;
 err_out_free:
+	if (ir_input_dev)
+		input_free_device(ir_input_dev->input_dev);
 	kfree(ir_input_dev);
 	kfree(ir);
 	return err;
-- 
1.7.0.4

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