From 398ec8789c2f2f522fea3b9b0ef45ac3da573b11 Mon Sep 17 00:00:00 2001 From: Alexey Zaytsev Date: Fri, 19 Dec 2008 05:45:56 +0300 Subject: [PATCH] Don't dereference released struct device. Signed-off-by: Alexey Zaytsev --- drivers/base/core.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 0042c4a..ee555d7 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -109,6 +109,7 @@ static struct sysfs_ops dev_sysfs_ops = { static void device_release(struct kobject *kobj) { struct device *dev = to_dev(kobj); + struct device_private *p = dev->p; if (dev->release) dev->release(dev); @@ -120,7 +121,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)); - kfree(dev->p); + kfree(p); } static struct kobj_type device_ktype = { -- 1.5.6.5