From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Vishal Verma <vishal.l.verma@intel.com>,
Toshi Kani <toshi.kani@hpe.com>,
Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH 4.11 109/114] libnvdimm, pmem: fix a NULL pointer BUG in nd_pmem_notify
Date: Thu, 18 May 2017 12:46:59 +0200 [thread overview]
Message-ID: <20170518103621.213375178@linuxfoundation.org> (raw)
In-Reply-To: <20170518103604.736737251@linuxfoundation.org>
4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <toshi.kani@hpe.com>
commit b2518c78ce76896f0f8f7940bf02104b227e1709 upstream.
The following BUG was observed when nd_pmem_notify() was called
for a BTT device. The use of a pmem_device pointer is not valid
with BTT.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
IP: nd_pmem_notify+0x30/0xf0 [nd_pmem]
Call Trace:
nd_device_notify+0x40/0x50
child_notify+0x10/0x20
device_for_each_child+0x50/0x90
nd_region_notify+0x20/0x30
nd_device_notify+0x40/0x50
nvdimm_region_notify+0x27/0x30
acpi_nfit_scrub+0x341/0x590 [nfit]
process_one_work+0x197/0x450
worker_thread+0x4e/0x4a0
kthread+0x109/0x140
Fix nd_pmem_notify() by setting nd_region and badblocks pointers
properly for BTT.
Cc: Vishal Verma <vishal.l.verma@intel.com>
Fixes: 719994660c24 ("libnvdimm: async notification support")
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/nvdimm/pmem.c | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -388,12 +388,12 @@ static void nd_pmem_shutdown(struct devi
static void nd_pmem_notify(struct device *dev, enum nvdimm_event event)
{
- struct pmem_device *pmem = dev_get_drvdata(dev);
- struct nd_region *nd_region = to_region(pmem);
+ struct nd_region *nd_region;
resource_size_t offset = 0, end_trunc = 0;
struct nd_namespace_common *ndns;
struct nd_namespace_io *nsio;
struct resource res;
+ struct badblocks *bb;
if (event != NVDIMM_REVALIDATE_POISON)
return;
@@ -402,20 +402,33 @@ static void nd_pmem_notify(struct device
struct nd_btt *nd_btt = to_nd_btt(dev);
ndns = nd_btt->ndns;
- } else if (is_nd_pfn(dev)) {
- struct nd_pfn *nd_pfn = to_nd_pfn(dev);
- struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb;
-
- ndns = nd_pfn->ndns;
- offset = pmem->data_offset + __le32_to_cpu(pfn_sb->start_pad);
- end_trunc = __le32_to_cpu(pfn_sb->end_trunc);
- } else
- ndns = to_ndns(dev);
+ nd_region = to_nd_region(ndns->dev.parent);
+ nsio = to_nd_namespace_io(&ndns->dev);
+ bb = &nsio->bb;
+ } else {
+ struct pmem_device *pmem = dev_get_drvdata(dev);
+
+ nd_region = to_region(pmem);
+ bb = &pmem->bb;
+
+ if (is_nd_pfn(dev)) {
+ struct nd_pfn *nd_pfn = to_nd_pfn(dev);
+ struct nd_pfn_sb *pfn_sb = nd_pfn->pfn_sb;
+
+ ndns = nd_pfn->ndns;
+ offset = pmem->data_offset +
+ __le32_to_cpu(pfn_sb->start_pad);
+ end_trunc = __le32_to_cpu(pfn_sb->end_trunc);
+ } else {
+ ndns = to_ndns(dev);
+ }
+
+ nsio = to_nd_namespace_io(&ndns->dev);
+ }
- nsio = to_nd_namespace_io(&ndns->dev);
res.start = nsio->res.start + offset;
res.end = nsio->res.end - end_trunc;
- nvdimm_badblocks_populate(nd_region, &pmem->bb, &res);
+ nvdimm_badblocks_populate(nd_region, bb, &res);
}
MODULE_ALIAS("pmem");
next prev parent reply other threads:[~2017-05-18 10:53 UTC|newest]
Thread overview: 116+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 10:45 [PATCH 4.11 000/114] 4.11.2-stable review Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 001/114] xen: adjust early dom0 p2m handling to xen hypervisor behavior Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 002/114] target: Fix compare_and_write_callback handling for non GOOD status Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 003/114] target/fileio: Fix zero-length READ and WRITE handling Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 004/114] iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 005/114] usb: xhci: bInterval quirk for TI TUSB73x0 Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 006/114] usb: host: xhci: print correct command ring address Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 007/114] USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 008/114] USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 010/114] staging: vt6656: use off stack for in buffer USB transfers Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 011/114] staging: vt6656: use off stack for out " Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 012/114] staging: gdm724x: gdm_mux: fix use-after-free on module unload Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 013/114] staging: wilc1000: Fix problem with wrong vif index Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 014/114] [media] staging: sir: fill in missing fields and fix probe Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 015/114] staging: comedi: jr3_pci: fix possible null pointer dereference Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 016/114] staging: comedi: jr3_pci: cope with jiffies wraparound Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 017/114] usb: misc: add missing continue in switch Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 018/114] usb: gadget: legacy gadgets are optional Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 019/114] usb: Make sure usb/phy/of gets built-in Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 020/114] usb: hub: Fix error loop seen after hub communication errors Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 021/114] usb: hub: Do not attempt to autosuspend disconnected devices Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 022/114] usb: misc: legousbtower: Fix buffers on stack Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 023/114] x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 024/114] selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 025/114] x86, pmem: Fix cache flushing for iovec write < 8 bytes Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 026/114] um: Fix PTRACE_POKEUSER on x86_64 Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 027/114] perf/x86: Fix Broadwell-EP DRAM RAPL events Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 029/114] Revert "KVM: Support vCPU-based gfn->hva cache" Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 030/114] KVM: arm/arm64: fix races in kvm_psci_vcpu_on Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 031/114] arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 032/114] block: fix blk_integrity_register to use templates interval_exp if not 0 Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 033/114] crypto: s5p-sss - Close possible race for completed requests Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 034/114] crypto: algif_aead - Require setkey before accept(2) Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 035/114] crypto: ccp - Use only the relevant interrupt bits Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 036/114] crypto: ccp - Disable interrupts early on unload Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 037/114] crypto: ccp - Change ISR handler method for a v3 CCP Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 038/114] crypto: ccp - Change ISR handler method for a v5 CCP Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 039/114] dm crypt: rewrite (wipe) key in crypto layer using random data Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 040/114] dm era: save spacemap metadata root after the pre-commit Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 041/114] dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue() Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 042/114] dm thin: fix a memory leak when passing discard bio down Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 043/114] vfio/type1: Remove locked page accounting workqueue Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 044/114] iov_iter: dont revert iov buffer if csum error Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 045/114] IB/core: Fix sysfs registration error flow Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 046/114] IB/core: Fix kernel crash during fail to initialize device Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 047/114] IB/core: For multicast functions, verify that LIDs are multicast LIDs Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 048/114] IB/IPoIB: ibX: failed to create mcg debug file Greg Kroah-Hartman
2017-05-18 10:45 ` [PATCH 4.11 049/114] IB/mlx4: Fix ib device initialization error flow Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 050/114] IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 051/114] IB/hfi1: Prevent kernel QP post send hard lockups Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 052/114] perf auxtrace: Fix no_size logic in addr_filter__resolve_kernel_syms() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 053/114] perf annotate s390: Fix perf annotate error -95 (4.10 regression) Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 054/114] perf annotate s390: Implement jump types for perf annotate Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 055/114] jbd2: fix dbench4 performance regression for nobarrier mounts Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 056/114] ext4: evict inline data when writing to memory map Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 057/114] orangefs: fix bounds check for listxattr Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 058/114] orangefs: clean up oversize xattr validation Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 059/114] orangefs: do not set getattr_time on orangefs_lookup Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 060/114] orangefs: do not check possibly stale size on truncate Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 061/114] fs/xattr.c: zero out memory copied to userspace in getxattr Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 062/114] ceph: fix memory leak in __ceph_setxattr() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 063/114] fs: fix data invalidation in the cleancache during direct IO Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 064/114] fs/block_dev: always invalidate cleancache in invalidate_bdev() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 065/114] mm: vmscan: fix IO/refault regression in cache workingset transition Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 066/114] mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 067/114] Fix match_prepath() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 068/114] Do not return number of bytes written for ioctl CIFS_IOC_COPYCHUNK_FILE Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 069/114] Set unicode flag on cifs echo request to avoid Mac error Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 070/114] SMB3: Work around mount failure when using SMB3 dialect to Macs Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 072/114] cifs: fix leak in FSCTL_ENUM_SNAPS response handling Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 073/114] cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 074/114] CIFS: fix oplock break deadlocks Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 075/114] cifs: fix CIFS_IOC_GET_MNT_INFO oops Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 077/114] ovl: do not set overlay.opaque on non-dir create Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 078/114] padata: free correct variable Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 079/114] md/raid1: avoid reusing a resync bio after error handling Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 080/114] device-dax: fix cdev leak Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 081/114] device-dax: fix sysfs attribute deadlock Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 082/114] dax: prevent invalidation of mapped DAX entries Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 083/114] mm: fix data corruption due to stale mmap reads Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 084/114] ext4: return to starting transaction in ext4_dax_huge_fault() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 085/114] dax: fix PMD data corruption when fault races with write Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 086/114] f2fs: fix wrong max cost initialization Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 087/114] Revert "f2fs: put allocate_segment after refresh_sit_entry" Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 088/114] f2fs: fix fs corruption due to zero inode page Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 089/114] f2fs: fix multiple f2fs_add_link() having same name for inline dentry Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 090/114] f2fs: check entire encrypted bigname when finding a dentry Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 091/114] f2fs: Make flush bios explicitely sync Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 092/114] initramfs: Always do fput() and load modules after rootfs populate Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 094/114] fscrypt: fix context consistency check when key(s) unavailable Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 095/114] fscrypt: avoid collisions when presenting long encrypted filenames Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 096/114] serial: samsung: Use right device for DMA-mapping calls Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 097/114] serial: samsung: Add missing checks for dma_map_single failure Greg Kroah-Hartman
2017-05-18 12:18 ` Krzysztof Kozlowski
2017-05-18 12:24 ` Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 098/114] serial: omap: fix runtime-pm handling on unbind Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 099/114] serial: omap: suspend device on probe errors Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 100/114] tty: pty: Fix ldisc flush after userspace become aware of the data already Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 101/114] tty: pl011: use "qdf2400_e44" as the earlycon name for QDF2400 E44 Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 102/114] Bluetooth: Fix user channel for 32bit userspace on 64bit kernel Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 103/114] Bluetooth: hci_bcm: add missing tty-device sanity check Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 104/114] Bluetooth: hci_intel: " Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 105/114] cgroup: fix spurious warnings on cgroup_is_dead() from cgroup_sk_alloc() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 106/114] libata: reject passthrough WRITE SAME requests Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 107/114] ipmi: Fix kernel panic at ipmi_ssif_thread() Greg Kroah-Hartman
2017-05-18 10:46 ` [PATCH 4.11 108/114] libnvdimm, region: fix flush hint detection crash Greg Kroah-Hartman
2017-05-18 10:46 ` Greg Kroah-Hartman [this message]
2017-05-18 10:47 ` [PATCH 4.11 110/114] libnvdimm: fix nvdimm_bus_lock() vs device_lock() ordering Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 111/114] libnvdimm, pfn: fix npfns vs section alignment Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 112/114] pstore: Fix flags to enable dumps on powerpc Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 113/114] pstore: Use dynamic spinlock initializer Greg Kroah-Hartman
2017-05-18 10:47 ` [PATCH 4.11 114/114] pstore: Shut down worker when unregistering Greg Kroah-Hartman
2017-05-18 19:46 ` [PATCH 4.11 000/114] 4.11.2-stable review Shuah Khan
2017-05-18 20:47 ` Greg Kroah-Hartman
2017-05-19 1:10 ` Guenter Roeck
2017-05-19 5:37 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170518103621.213375178@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=dan.j.williams@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=toshi.kani@hpe.com \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).