summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-30 00:45:23 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-30 00:45:23 +0400
commit434ac47d0ff36af4ca56bb979592cac8efd32c34 (patch)
tree98395ff1d6e00382183907d60ddccff29032aa8a
parentc23c2234de418d32f5b1cd1b7f2d22a13fd8e7fa (diff)
parentf123db8e9d6c84c863cb3c44d17e61995dc984fb (diff)
downloadlinux-434ac47d0ff36af4ca56bb979592cac8efd32c34.tar.xz
Merge tag 'driver-core-3.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core / sysfs fixes from Greg KH: "Here are 2 fixes for 3.12-rc3. One fixes a sysfs problem with mounting caused by 3.12-rc1, and the other is a bug reported by the chromeos developers with the driver core. Both have been in linux-next for a bit" * tag 'driver-core-3.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: driver core : Fix use after free of dev->parent in device_shutdown sysfs: Allow mounting without CONFIG_NET
-rw-r--r--drivers/base/core.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index c7cfadcf6752..34abf4d8a45f 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2017,7 +2017,7 @@ EXPORT_SYMBOL_GPL(device_move);
*/
void device_shutdown(void)
{
- struct device *dev;
+ struct device *dev, *parent;
spin_lock(&devices_kset->list_lock);
/*
@@ -2034,7 +2034,7 @@ void device_shutdown(void)
* prevent it from being freed because parent's
* lock is to be held
*/
- get_device(dev->parent);
+ parent = get_device(dev->parent);
get_device(dev);
/*
* Make sure the device is off the kset list, in the
@@ -2044,8 +2044,8 @@ void device_shutdown(void)
spin_unlock(&devices_kset->list_lock);
/* hold lock to avoid race with probe/release */
- if (dev->parent)
- device_lock(dev->parent);
+ if (parent)
+ device_lock(parent);
device_lock(dev);
/* Don't allow any more runtime suspends */
@@ -2063,11 +2063,11 @@ void device_shutdown(void)
}
device_unlock(dev);
- if (dev->parent)
- device_unlock(dev->parent);
+ if (parent)
+ device_unlock(parent);
put_device(dev);
- put_device(dev->parent);
+ put_device(parent);
spin_lock(&devices_kset->list_lock);
}