Skip to content

Commit 25e19c1

Browse files
committed
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.
2 parents c67a98c + 2121db0 commit 25e19c1

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

drivers/acpi/nfit/core.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,9 +2928,9 @@ static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc)
29282928
return rc;
29292929

29302930
if (ars_status_process_records(acpi_desc))
2931-
return -ENOMEM;
2931+
dev_err(acpi_desc->dev, "Failed to process ARS records\n");
29322932

2933-
return 0;
2933+
return rc;
29342934
}
29352935

29362936
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,
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,

tools/testing/nvdimm/test/nfit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ static u32 handle[] = {
140140
[6] = NFIT_DIMM_HANDLE(1, 0, 0, 0, 1),
141141
};
142142

143-
static unsigned long dimm_fail_cmd_flags[NUM_DCR];
144-
static int dimm_fail_cmd_code[NUM_DCR];
143+
static unsigned long dimm_fail_cmd_flags[ARRAY_SIZE(handle)];
144+
static int dimm_fail_cmd_code[ARRAY_SIZE(handle)];
145145

146146
static const struct nd_intel_smart smart_def = {
147147
.flags = ND_INTEL_SMART_HEALTH_VALID
@@ -205,7 +205,7 @@ struct nfit_test {
205205
unsigned long deadline;
206206
spinlock_t lock;
207207
} ars_state;
208-
struct device *dimm_dev[NUM_DCR];
208+
struct device *dimm_dev[ARRAY_SIZE(handle)];
209209
struct nd_intel_smart *smart;
210210
struct nd_intel_smart_threshold *smart_threshold;
211211
struct badrange badrange;
@@ -2680,7 +2680,7 @@ static int nfit_test_probe(struct platform_device *pdev)
26802680
u32 nfit_handle = __to_nfit_memdev(nfit_mem)->device_handle;
26812681
int i;
26822682

2683-
for (i = 0; i < NUM_DCR; i++)
2683+
for (i = 0; i < ARRAY_SIZE(handle); i++)
26842684
if (nfit_handle == handle[i])
26852685
dev_set_drvdata(nfit_test->dimm_dev[i],
26862686
nfit_mem);

0 commit comments

Comments
 (0)