[GIT PULL] libnvdimm fixes for 4.13-rc2

From: Williams, Dan J
Date: Thu Jul 20 2017 - 10:51:05 EST


Hi Linus, please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm tags/libnvdimm-fixes-4.13-rc2

...to receive a handful of small fixes for 4.13-rc2. 3 of these fixes
are tagged for+AKA--stable. They have all appeared in at least one -next
release with no reported issues. Full commit log below:

---

The following changes since commit 5771a8c08880cdca3bfb4a3fc6d309d6bba20877:

Linux v4.13-rc1 (2017-07-15 15:22:10 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm tags/libnvdimm-fixes-4.13-rc2

for you to fetch changes up to bbb3be170ac2891526ad07b18af7db226879a8e7:

device-dax: fix sysfs duplicate warnings (2017-07-18 17:49:14 -0700)

----------------------------------------------------------------
libnvdimm for 4.13-rc2

+ACo- Fix handling of media errors that span a sector

+ACo- Fix support of multiple namespaces in a libnvdimm region being in
device-dax mode

+ACo- Clean up the machine check notifier properly when the nfit driver
fails to register

+ACo- Address a static analysis (smatch) report in device-dax

----------------------------------------------------------------
Dan Williams (3):
device-dax: fix 'passing zero to ERR+AF8-PTR()' warning
MAINTAINERS: list drivers/acpi/nfit/ files for libnvdimm sub-system
device-dax: fix sysfs duplicate warnings

Prarit Bhargava (1):
acpi/nfit: Fix memory corruption/Unregister mce decoder on failure

Toshi Kani (1):
libnvdimm: fix badblock range handling of ARS range

MAINTAINERS +AHw- 2 +--
drivers/acpi/nfit/core.c +AHw- 10 +-+-+-+-+-+-+-+-+--
drivers/dax/device-dax.h +AHw- 2 +--
drivers/dax/device.c +AHw- 33 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-----------
drivers/dax/pmem.c +AHw- 12 +-+-+-+-+-+-+------
drivers/nvdimm/core.c +AHw- 7 +-+-+-+----
6 files changed, 45 insertions(+-), 21 deletions(-)

---

commit 4e3f0701f25ab194c5362576b1146a1e6cc6c2e7
Author: Toshi Kani +ADw-toshi.kani+AEA-hpe.com+AD4-
Date: Fri Jul 7 17:44:26 2017 -0600

libnvdimm: fix badblock range handling of ARS range

+AF8AXw-add+AF8-badblock+AF8-range() does not account sector alignment when
it sets 'num+AF8-sectors'. Therefore, an ARS error record range
spanning across two sectors is set to a single sector length,
which leaves the 2nd sector unprotected.

Change +AF8AXw-add+AF8-badblock+AF8-range() to set 'num+AF8-sectors' properly.

Cc: +ADw-stable+AEA-vger.kernel.org+AD4-
Fixes: 0caeef63e6d2 (+ACI-libnvdimm: Add a poison list and export badblocks+ACI-)
Signed-off-by: Toshi Kani +ADw-toshi.kani+AEA-hpe.com+AD4-
Reviewed-by: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 43fe51e11c194a6576634585f81ba33e104194a5
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Wed Jul 12 13:42:37 2017 -0700

device-dax: fix 'passing zero to ERR+AF8-PTR()' warning

Dan Carpenter reports:

The patch 7b6be8444e0f: +ACI-dax: refactor dax-fs into a generic provider
of 'struct dax+AF8-device' instances+ACI- from Apr 11, 2017, leads to the
following static checker warning:

drivers/dax/device.c:643 devm+AF8-create+AF8-dev+AF8-dax()
warn: passing zero to 'ERR+AF8-PTR'

Fix the case where we inadvertently leak 0 to ERR+AF8-PTR() by setting at
every error case, and make it clear that 'count' is never 0.

Reported-by: Dan Carpenter +ADw-dan.carpenter+AEA-oracle.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 7e700d2c59e5853c9126642976b4f5768f64c9b3
Author: Prarit Bhargava +ADw-prarit+AEA-redhat.com+AD4-
Date: Wed May 31 13:32:00 2017 -0400

acpi/nfit: Fix memory corruption/Unregister mce decoder on failure

nfit+AF8-init() calls nfit+AF8-mce+AF8-register() on module load. When the module
load fails the nfit mce decoder is not unregistered. The module's
memory is freed leaving the decoder chain referencing junk. This will
cause panics as future registrations will reference the free'd memory.

Unregister the nfit mce decoder on module init failure.

+AFs-v2+AF0-: register and then unregister mce handler to avoid losing mce events
+AFs-v3+AF0-: also cleanup nfit workqueue

Fixes: 6839a6d96f4e (+ACI-nfit: do an ARS scrub on hitting a latent media error+ACI-)
Cc: +ADw-stable+AEA-vger.kernel.org+AD4-
Cc: +ACI-Rafael J. Wysocki+ACI- +ADw-rjw+AEA-rjwysocki.net+AD4-
Cc: Len Brown +ADw-lenb+AEA-kernel.org+AD4-
Cc: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Cc: +ACI-Lee, Chun-Yi+ACI- +ADw-joeyli.kernel+AEA-gmail.com+AD4-
Cc: Linda Knippers +ADw-linda.knippers+AEA-hpe.com+AD4-
Cc: lszubowi+AEA-redhat.com
Acked-by: Jeff Moyer +ADw-jmoyer+AEA-redhat.com+AD4-
Signed-off-by: Prarit Bhargava +ADw-prarit+AEA-redhat.com+AD4-
Reviewed-by: Vishal Verma +ADw-vishal.l.verma+AEA-intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit 23b9babb50ff5ac8eb9208b978b2a630e99bf90b
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Mon Jul 17 09:58:51 2017 -0700

MAINTAINERS: list drivers/acpi/nfit/ files for libnvdimm sub-system

Patches that update the drivers/acpi/nfit/ directory need to be copied
to the nvdimm mailing list. The drivers/acpi/nfit+ACo- glob has been broken
ever since the nfit driver source was refactored into multiple files
under the drivers/acpi/nfit/ directory.

Reported-by: Prarit Bhargava +ADw-prarit+AEA-redhat.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-

commit bbb3be170ac2891526ad07b18af7db226879a8e7
Author: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-
Date: Tue Jul 18 17:49:14 2017 -0700

device-dax: fix sysfs duplicate warnings

Fix warnings of the form...

WARNING: CPU: 10 PID: 4983 at fs/sysfs/dir.c:31 sysfs+AF8-warn+AF8-dup+-0x62/0x80
sysfs: cannot create duplicate filename '/class/dax/dax12.0'
Call Trace:
dump+AF8-stack+-0x63/0x86
+AF8AXw-warn+-0xcb/0xf0
warn+AF8-slowpath+AF8-fmt+-0x5a/0x80
? kernfs+AF8-path+AF8-from+AF8-node+-0x4f/0x60
sysfs+AF8-warn+AF8-dup+-0x62/0x80
sysfs+AF8-do+AF8-create+AF8-link+AF8-sd.isra.2+-0x97/0xb0
sysfs+AF8-create+AF8-link+-0x25/0x40
device+AF8-add+-0x266/0x630
devm+AF8-create+AF8-dax+AF8-dev+-0x2cf/0x340 +AFs-dax+AF0-
dax+AF8-pmem+AF8-probe+-0x1f5/0x26e +AFs-dax+AF8-pmem+AF0-
nvdimm+AF8-bus+AF8-probe+-0x71/0x120

...by reusing the namespace id for the device-dax instance name.

Now that we have decided that there will never by more than one
device-dax instance per libnvdimm-namespace parent device +AFs-1+AF0-, we can
directly reuse the namepace ids. There are some possible follow-on
cleanups, but those are saved for a later patch to simplify the -stable
backport.

+AFs-1+AF0-: https://lists.01.org/pipermail/linux-nvdimm/2016-December/008266.html

Fixes: 98a29c39dc68 (+ACI-libnvdimm, namespace: allow creation of multiple pmem...+ACI-)
Cc: Jeff Moyer +ADw-jmoyer+AEA-redhat.com+AD4-
Cc: +ADw-stable+AEA-vger.kernel.org+AD4-
Reported-by: Dariusz Dokupil +ADw-dariusz.dokupil+AEA-intel.com+AD4-
Signed-off-by: Dan Williams +ADw-dan.j.williams+AEA-intel.com+AD4-