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]
Date:	Sun, 17 Jun 2012 21:47:59 +0530
From:	Devendra Naga <devendra.aaru@...il.com>
To:	Evgeniy Polyakov <zbr@...emap.net>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Cc:	Devendra Naga <devendra.aaru@...il.com>
Subject: [PATCH] drivers/w1: free the w1_master at w1_free_dev and return a correct return value

the w1_master pointer is allced at the w1_alloc_master and is not freed when called with
w1_remove_master.

when w1_alloc_dev fails the return should be -ENODEV as it does
device_register, and that is the last case where that function
will fail.

Signed-off-by: Devendra Naga <devendra.aaru@...il.com>
---
 drivers/w1/w1_int.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 6828835..a3cf27d 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -100,6 +100,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
 static void w1_free_dev(struct w1_master *dev)
 {
 	device_unregister(&dev->dev);
+	kfree(dev);
 }
 
 int w1_add_master_device(struct w1_bus_master *master)
@@ -148,7 +149,7 @@ int w1_add_master_device(struct w1_bus_master *master)
 		&w1_master_driver, &w1_master_device);
 	if (!dev) {
 		mutex_unlock(&w1_mlock);
-		return -ENOMEM;
+		return -ENODEV;
 	}
 
 	retval =  w1_create_master_attributes(dev);
-- 
1.7.9.5

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