Skip to content

Commit 2121db0

Browse files
committed
Revert "acpi, nfit: Further restrict userspace ARS start requests"
The following lockdep splat results from acquiring the init_mutex in acpi_nfit_clear_to_send(): WARNING: possible circular locking dependency detected lt-daxdev-error/7216 is trying to acquire lock: 00000000f694db15 (&acpi_desc->init_mutex){+.+.}, at: acpi_nfit_clear_to_send+0x27/0x80 [nfit] but task is already holding lock: 00000000182298f2 (&nvdimm_bus->reconfig_mutex){+.+.}, at: __nd_ioctl+0x457/0x610 [libnvdimm] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&nvdimm_bus->reconfig_mutex){+.+.}: nvdimm_badblocks_populate+0x41/0x150 [libnvdimm] nd_region_notify+0x95/0xb0 [libnvdimm] nd_device_notify+0x40/0x50 [libnvdimm] ars_complete+0x7f/0xd0 [nfit] acpi_nfit_scrub+0xbb/0x410 [nfit] process_one_work+0x22b/0x5c0 worker_thread+0x3c/0x390 kthread+0x11e/0x140 ret_from_fork+0x3a/0x50 -> #0 (&acpi_desc->init_mutex){+.+.}: __mutex_lock+0x83/0x980 acpi_nfit_clear_to_send+0x27/0x80 [nfit] __nd_ioctl+0x474/0x610 [libnvdimm] nd_ioctl+0xa4/0xb0 [libnvdimm] do_vfs_ioctl+0xa5/0x6e0 ksys_ioctl+0x70/0x80 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x60/0x210 entry_SYSCALL_64_after_hwframe+0x49/0xbe New infrastructure is needed to be able to perform this check without acquiring the lock. Fixes: 5948612 ("acpi, nfit: Further restrict userspace ARS start") Cc: Dave Jiang <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent 3fa58dc commit 2121db0

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

drivers/acpi/nfit/core.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,8 +3341,6 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,
33413341
struct nvdimm *nvdimm, unsigned int cmd)
33423342
{
33433343
struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc);
3344-
struct nfit_spa *nfit_spa;
3345-
int rc = 0;
33463344

33473345
if (nvdimm)
33483346
return 0;
@@ -3355,17 +3353,10 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,
33553353
* just needs guarantees that any ARS it initiates are not
33563354
* interrupted by any intervening start requests from userspace.
33573355
*/
3358-
mutex_lock(&acpi_desc->init_mutex);
3359-
list_for_each_entry(nfit_spa, &acpi_desc->spas, list)
3360-
if (acpi_desc->scrub_spa
3361-
|| test_bit(ARS_REQ_SHORT, &nfit_spa->ars_state)
3362-
|| test_bit(ARS_REQ_LONG, &nfit_spa->ars_state)) {
3363-
rc = -EBUSY;
3364-
break;
3365-
}
3366-
mutex_unlock(&acpi_desc->init_mutex);
3356+
if (work_busy(&acpi_desc->dwork.work))
3357+
return -EBUSY;
33673358

3368-
return rc;
3359+
return 0;
33693360
}
33703361

33713362
int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc,

0 commit comments

Comments
 (0)