You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
libnvdimm: pfn_devs: Fix locking in namespace_store
Always take device_lock() before nvdimm_bus_lock() to prevent deadlock. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
@@ -148,13 +148,13 @@ static ssize_t namespace_store(struct device *dev,
|
|||||||
struct nd_pfn *nd_pfn = to_nd_pfn(dev);
|
struct nd_pfn *nd_pfn = to_nd_pfn(dev);
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
|
|
||||||
nvdimm_bus_lock(dev);
|
|
||||||
device_lock(dev);
|
device_lock(dev);
|
||||||
|
nvdimm_bus_lock(dev);
|
||||||
rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
|
rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
||||||
device_unlock(dev);
|
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
|
device_unlock(dev);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user