diff options
author | Dan Williams <dan.j.williams@intel.com> | 2018-11-03 20:53:09 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2018-11-10 12:54:28 -0500 |
commit | 2121db09630113e67b51ae78c18115f1858f648a (patch) | |
tree | 4b397bbf46cc95ad8a7d4a76ec28bb298110d015 | |
parent | 3fa58dcab50a0aa16817f16a8d38aee869eb3fb9 (diff) |
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: 594861215c83 ("acpi, nfit: Further restrict userspace ARS start")
Cc: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/acpi/nfit/core.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 5970b8f5f768..14d9f5bea015 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -3341,8 +3341,6 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, | |||
3341 | struct nvdimm *nvdimm, unsigned int cmd) | 3341 | struct nvdimm *nvdimm, unsigned int cmd) |
3342 | { | 3342 | { |
3343 | struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); | 3343 | struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc); |
3344 | struct nfit_spa *nfit_spa; | ||
3345 | int rc = 0; | ||
3346 | 3344 | ||
3347 | if (nvdimm) | 3345 | if (nvdimm) |
3348 | return 0; | 3346 | return 0; |
@@ -3355,17 +3353,10 @@ static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc, | |||
3355 | * just needs guarantees that any ARS it initiates are not | 3353 | * just needs guarantees that any ARS it initiates are not |
3356 | * interrupted by any intervening start requests from userspace. | 3354 | * interrupted by any intervening start requests from userspace. |
3357 | */ | 3355 | */ |
3358 | mutex_lock(&acpi_desc->init_mutex); | 3356 | if (work_busy(&acpi_desc->dwork.work)) |
3359 | list_for_each_entry(nfit_spa, &acpi_desc->spas, list) | 3357 | return -EBUSY; |
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); | ||
3367 | 3358 | ||
3368 | return rc; | 3359 | return 0; |
3369 | } | 3360 | } |
3370 | 3361 | ||
3371 | int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, | 3362 | int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc, |