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:	Wed, 16 Jan 2013 17:22:34 +0100 (CET)
From:	Guennadi Liakhovetski <g.liakhovetski@....de>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] drivers: avoid use after free of a pinctrl context pointer

During probing, pinctrl context is allocated and assigned to the struct
device::pins pointer. If probing fails or if the driver is later unbound
and re-probed again, the memory is freed, but the pointer is not cleared.
On a repeated probing attempt a non-NULL pointer indicates an already
allocated context, which then gets used. To avoid this the pointer must
be cleared.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@....de>
---
 drivers/base/dd.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 65631015..e5c71b5 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -302,6 +302,7 @@ probe_failed:
 	devres_release_all(dev);
 	driver_sysfs_remove(dev);
 	dev->driver = NULL;
+	dev->pins = NULL;
 	dev_set_drvdata(dev, NULL);
 
 	if (ret == -EPROBE_DEFER) {
@@ -505,6 +506,7 @@ static void __device_release_driver(struct device *dev)
 			drv->remove(dev);
 		devres_release_all(dev);
 		dev->driver = NULL;
+		dev->pins = NULL;
 		dev_set_drvdata(dev, NULL);
 		klist_remove(&dev->p->knode_driver);
 		if (dev->bus)
-- 
1.7.2.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