Skip to content

Commit eedfd73

Browse files
weiny2stellarhopper
authored andcommitted
drivers/dax: Expand lock scope to cover the use of addresses
The addition of PKS protection to dax read lock/unlock will require that the address returned by dax_direct_access() be protected by this lock. Correct the locking by ensuring that the use of kaddr and end_kaddr are covered by the dax read lock/unlock. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Dan Williams <[email protected]> Signed-off-by: Ira Weiny <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent c7fe193 commit eedfd73

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/dax/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
103103
id = dax_read_lock();
104104
len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn);
105105
len2 = dax_direct_access(dax_dev, pgoff_end, 1, &end_kaddr, &end_pfn);
106-
dax_read_unlock(id);
107106

108107
if (len < 1 || len2 < 1) {
109108
pr_info("%s: error: dax access failed (%ld)\n",
110109
bdevname(bdev, buf), len < 1 ? len : len2);
110+
dax_read_unlock(id);
111111
return false;
112112
}
113113

@@ -137,6 +137,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev,
137137
put_dev_pagemap(end_pgmap);
138138

139139
}
140+
dax_read_unlock(id);
140141

141142
if (!dax_enabled) {
142143
pr_info("%s: error: dax support not enabled\n",

0 commit comments

Comments
 (0)