浏览代码

firewire: Grab dev->sem when doing the update callback.

This serializes the update callback with the probe and remove callback from
the driver core and prevents remove from being called while update is
running for the same device.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Kristian Høgsberg 18 年之前
父节点
当前提交
015b066f4e
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      drivers/firewire/fw-device.c

+ 4 - 1
drivers/firewire/fw-device.c

@@ -562,8 +562,11 @@ static int update_unit(struct device *dev, void *data)
 	struct fw_unit *unit = fw_unit(dev);
 	struct fw_driver *driver = (struct fw_driver *)dev->driver;
 
-	if (is_fw_unit(dev) && driver != NULL && driver->update != NULL)
+	if (is_fw_unit(dev) && driver != NULL && driver->update != NULL) {
+		down(&dev->sem);
 		driver->update(unit);
+		up(&dev->sem);
+	}
 
 	return 0;
 }