Skip to content

Commit 8d13c02

Browse files
toshikanidjbw
authored andcommitted
libnvdimm: fix clear length of nvdimm_forget_poison()
ND_CMD_CLEAR_ERROR command returns 'clear_err.cleared', the length of error actually cleared, which may be smaller than its requested 'len'. Change nvdimm_clear_poison() to call nvdimm_forget_poison() with 'clear_err.cleared' when this value is valid. Cc: <stable@vger.kernel.org> Fixes: e046114 ("libnvdimm: clear the internal poison_list when clearing badblocks") Cc: Dave Jiang <dave.jiang@intel.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Toshi Kani <toshi.kani@hpe.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent b2518c7 commit 8d13c02

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/nvdimm/bus.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
219219
if (cmd_rc < 0)
220220
return cmd_rc;
221221

222-
nvdimm_forget_poison(nvdimm_bus, phys, len);
222+
if (clear_err.cleared > 0)
223+
nvdimm_forget_poison(nvdimm_bus, phys, clear_err.cleared);
224+
223225
return clear_err.cleared;
224226
}
225227
EXPORT_SYMBOL_GPL(nvdimm_clear_poison);

0 commit comments

Comments
 (0)