diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-18 15:21:09 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-11-18 15:21:09 -0500 |
commit | 25e19c1fe421280a47f37c3571aa379e6e67966c (patch) | |
tree | 3635424070da53b33adcbd023657a6b8bcf805a5 | |
parent | c67a98c00ea3c1fad14833f440fcd770232d24e7 (diff) | |
parent | 2121db09630113e67b51ae78c18115f1858f648a (diff) |
Merge tag 'libnvdimm-fixes-4.20-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams:
"A small batch of fixes for v4.20-rc3.
The overflow continuation fix addresses something that has been broken
for several releases. Arguably it could wait even longer, but it's a
one line fix and this finishes the last of the known address range
scrub bug reports. The revert addresses a lockdep regression. The unit
tests are not critical to fix, but no reason to hold this fix back.
Summary:
- Address Range Scrub overflow continuation handling has been broken
since it was initially merged. It was only recently that error
injection and platform-BIOS support enabled this corner case to be
exercised.
- The recent attempt to provide more isolation for the kernel Address
Range Scrub state machine from userapace initiated sessions
triggers a lockdep report. Revert and try again at the next merge
window.
- Fix a kasan reported buffer overflow in libnvdimm unit test
infrastrucutre (nfit_test)"
* tag 'libnvdimm-fixes-4.20-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
Revert "acpi, nfit: Further restrict userspace ARS start requests"
acpi, nfit: Fix ARS overflow continuation
tools/testing/nvdimm: Fix the array size for dimm devices.
-rw-r--r-- | drivers/acpi/nfit/core.c | 19 | ||||
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 8 |
2 files changed, 9 insertions, 18 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index f8c638f3c946..14d9f5bea015 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -2928,9 +2928,9 @@ static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc) | |||
2928 | return rc; | 2928 | return rc; |
2929 | 2929 | ||
2930 | if (ars_status_process_records(acpi_desc)) | 2930 | if (ars_status_process_records(acpi_desc)) |
2931 | return -ENOMEM; | 2931 | dev_err(acpi_desc->dev, "Failed to process ARS records\n"); |
2932 | 2932 | ||
2933 | return 0; | 2933 | return rc; |
2934 | } | 2934 | } |
2935 | 2935 | ||
2936 | static int ars_register(struct acpi_nfit_desc *acpi_desc, | 2936 | static int ars_register(struct acpi_nfit_desc *acpi_desc, |
@@ -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, |
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 9527d47a1070..01ec04bf91b5 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -140,8 +140,8 @@ static u32 handle[] = { | |||
140 | [6] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 1), | 140 | [6] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 1), |
141 | }; | 141 | }; |
142 | 142 | ||
143 | static unsigned long dimm_fail_cmd_flags[NUM_DCR]; | 143 | static unsigned long dimm_fail_cmd_flags[ARRAY_SIZE(handle)]; |
144 | static int dimm_fail_cmd_code[NUM_DCR]; | 144 | static int dimm_fail_cmd_code[ARRAY_SIZE(handle)]; |
145 | 145 | ||
146 | static const struct nd_intel_smart smart_def = { | 146 | static const struct nd_intel_smart smart_def = { |
147 | .flags = ND_INTEL_SMART_HEALTH_VALID | 147 | .flags = ND_INTEL_SMART_HEALTH_VALID |
@@ -205,7 +205,7 @@ struct nfit_test { | |||
205 | unsigned long deadline; | 205 | unsigned long deadline; |
206 | spinlock_t lock; | 206 | spinlock_t lock; |
207 | } ars_state; | 207 | } ars_state; |
208 | struct device *dimm_dev[NUM_DCR]; | 208 | struct device *dimm_dev[ARRAY_SIZE(handle)]; |
209 | struct nd_intel_smart *smart; | 209 | struct nd_intel_smart *smart; |
210 | struct nd_intel_smart_threshold *smart_threshold; | 210 | struct nd_intel_smart_threshold *smart_threshold; |
211 | struct badrange badrange; | 211 | struct badrange badrange; |
@@ -2680,7 +2680,7 @@ static int nfit_test_probe(struct platform_device *pdev) | |||
2680 | u32 nfit_handle = __to_nfit_memdev(nfit_mem)->device_handle; | 2680 | u32 nfit_handle = __to_nfit_memdev(nfit_mem)->device_handle; |
2681 | int i; | 2681 | int i; |
2682 | 2682 | ||
2683 | for (i = 0; i < NUM_DCR; i++) | 2683 | for (i = 0; i < ARRAY_SIZE(handle); i++) |
2684 | if (nfit_handle == handle[i]) | 2684 | if (nfit_handle == handle[i]) |
2685 | dev_set_drvdata(nfit_test->dimm_dev[i], | 2685 | dev_set_drvdata(nfit_test->dimm_dev[i], |
2686 | nfit_mem); | 2686 | nfit_mem); |