Commit 434ac47d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'driver-core-3.12-rc3' of...

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
parents c23c2234 f123db8e
...@@ -2017,7 +2017,7 @@ EXPORT_SYMBOL_GPL(device_move); ...@@ -2017,7 +2017,7 @@ EXPORT_SYMBOL_GPL(device_move);
*/ */
void device_shutdown(void) void device_shutdown(void)
{ {
struct device *dev; struct device *dev, *parent;
spin_lock(&devices_kset->list_lock); spin_lock(&devices_kset->list_lock);
/* /*
...@@ -2034,7 +2034,7 @@ void device_shutdown(void) ...@@ -2034,7 +2034,7 @@ void device_shutdown(void)
* prevent it from being freed because parent's * prevent it from being freed because parent's
* lock is to be held * lock is to be held
*/ */
get_device(dev->parent); parent = get_device(dev->parent);
get_device(dev); get_device(dev);
/* /*
* Make sure the device is off the kset list, in the * Make sure the device is off the kset list, in the
...@@ -2044,8 +2044,8 @@ void device_shutdown(void) ...@@ -2044,8 +2044,8 @@ void device_shutdown(void)
spin_unlock(&devices_kset->list_lock); spin_unlock(&devices_kset->list_lock);
/* hold lock to avoid race with probe/release */ /* hold lock to avoid race with probe/release */
if (dev->parent) if (parent)
device_lock(dev->parent); device_lock(parent);
device_lock(dev); device_lock(dev);
/* Don't allow any more runtime suspends */ /* Don't allow any more runtime suspends */
...@@ -2063,11 +2063,11 @@ void device_shutdown(void) ...@@ -2063,11 +2063,11 @@ void device_shutdown(void)
} }
device_unlock(dev); device_unlock(dev);
if (dev->parent) if (parent)
device_unlock(dev->parent); device_unlock(parent);
put_device(dev); put_device(dev);
put_device(dev->parent); put_device(parent);
spin_lock(&devices_kset->list_lock); spin_lock(&devices_kset->list_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment