提交 3ef1701b 编写于 作者: R Rafael J. Wysocki 提交者: Xie XiuQi

driver core: Add missing dev->bus->need_parent_lock checks

commit e121a833745b4708b660e3fe6776129c2956b041 upstream.

__device_release_driver() has to check dev->bus->need_parent_lock
before dropping the parent lock and acquiring it again as it may
attempt to drop a lock that hasn't been acquired or lock a device
that shouldn't be locked and create a lock imbalance.

Fixes: 8c97a46a (driver core: hold dev's parent lock when needed)
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 f1d1f876
......@@ -931,11 +931,11 @@ static void __device_release_driver(struct device *dev, struct device *parent)
while (device_links_busy(dev)) {
device_unlock(dev);
if (parent)
if (parent && dev->bus->need_parent_lock)
device_unlock(parent);
device_links_unbind_consumers(dev);
if (parent)
if (parent && dev->bus->need_parent_lock)
device_lock(parent);
device_lock(dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册