[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0910010950330.4408@axis700.grange>
Date: Thu, 1 Oct 2009 10:02:08 +0200 (CEST)
From: Guennadi Liakhovetski <g.liakhovetski@....de>
To: linux-kernel@...r.kernel.org
cc: Greg KH <greg@...ah.com>
Subject: [PATCH] drivers-core: nullify private pointer on device-release
Device structures can be reused over multiple device_add / device_release
cycles. As the private pointer in that struct is checked for NULL, it has
to be nullified after freeing the private data. Failure to do so causes a
use after free bug.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@....de>
---
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 6bee6af..3c9f449 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -122,6 +122,7 @@ static void device_release(struct kobject *kobj)
WARN(1, KERN_ERR "Device '%s' does not have a release() "
"function, it is broken and must be fixed.\n",
dev_name(dev));
+ dev->p = NULL;
kfree(p);
}
--
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