alistair23-linux/include
Dan Williams 86ef58a4e3 nfit, libnvdimm: fix interleave set cookie calculation
The interleave-set cookie is a sum that sanity checks the composition of
an interleave set has not changed from when the namespace was initially
created.  The checksum is calculated by sorting the DIMMs by their
location in the interleave-set. The comparison for the sort must be
64-bit wide, not byte-by-byte as performed by memcmp() in the broken
case.

Fix the implementation to accept correct cookie values in addition to
the Linux "memcmp" order cookies, but only allow correct cookies to be
generated going forward. It does mean that namespaces created by
third-party-tooling, or created by newer kernels with this fix, will not
validate on older kernels. However, there are a couple mitigating
conditions:

    1/ platforms with namespace-label capable NVDIMMs are not widely
       available.

    2/ interleave-sets with a single-dimm are by definition not affected
       (nothing to sort). This covers the QEMU-KVM NVDIMM emulation case.

The cookie stored in the namespace label will be fixed by any write the
namespace label, the most straightforward way to achieve this is to
write to the "alt_name" attribute of a namespace in sysfs.

Cc: <stable@vger.kernel.org>
Fixes: eaf961536e ("libnvdimm, nfit: add interleave-set state-tracking infrastructure")
Reported-by: Nicholas Moulin <nicholas.w.moulin@linux.intel.com>
Tested-by: Nicholas Moulin <nicholas.w.moulin@linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2017-03-01 00:49:42 -08:00
..
acpi
asm-generic modversions: treat symbol CRCs as 32 bit quantities 2017-02-03 08:28:25 -08:00
clocksource
crypto
drm drm: Don't race connector registration 2017-01-30 10:17:32 +01:00
dt-bindings
keys
kvm KVM: arm64: Access CNTHCTL_EL2 bit fields correctly on VHE systems 2017-01-13 11:19:25 +00:00
linux nfit, libnvdimm: fix interleave set cookie calculation 2017-03-01 00:49:42 -08:00
math-emu
media
memory
misc
net lwtunnel: valid encap attr check should return 0 when lwtunnel is disabled 2017-02-08 12:52:11 -05:00
pcmcia
ras
rdma RDMA/core: Add the function ib_mtu_int_to_enum 2017-01-24 15:34:22 -05:00
rxrpc
scsi Merge remote-tracking branch 'mkp-scsi/fixes' into fixes 2017-01-17 17:32:54 -05:00
soc ARCv2: MCIP: update the BCR per current changes 2017-01-24 11:05:59 -08:00
sound Merge remote-tracking branches 'asoc/fix/arizona', 'asoc/fix/dpcm', 'asoc/fix/dwc', 'asoc/fix/fsl-ssi' and 'asoc/fix/hdmi-codec' into asoc-linus 2017-01-10 10:47:50 +00:00
target target: Fix multi-session dynamic se_node_acl double free OOPs 2017-02-08 08:25:23 -08:00
trace Merge branch 'for-linus-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2017-01-13 17:40:22 -08:00
uapi Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-02-16 08:37:18 -08:00
video
xen
Kbuild