linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Dan Williams <dan.j.williams@intel.com>
Subject: [PATCH 4.9 036/130] libnvdimm, namespace: fix pmem namespace leak, delete when size set to zero
Date: Tue, 24 Jan 2017 08:54:36 +0100	[thread overview]
Message-ID: <20170124075536.434300398@linuxfoundation.org> (raw)
In-Reply-To: <20170124075534.905042535@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Williams <dan.j.williams@intel.com>

commit 1f19b983a8877f81763fab3e693c6befe212736d upstream.

Commit 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple
pmem-namespaces per region") added support for establishing additional
pmem namespace beyond the seed device, similar to blk namespaces.
However, it neglected to delete the namespace when the size is set to
zero.

Fixes: 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple pmem-namespaces per region")
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/nvdimm/namespace_devs.c |   23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -957,6 +957,7 @@ static ssize_t __size_store(struct devic
 {
 	resource_size_t allocated = 0, available = 0;
 	struct nd_region *nd_region = to_nd_region(dev->parent);
+	struct nd_namespace_common *ndns = to_ndns(dev);
 	struct nd_mapping *nd_mapping;
 	struct nvdimm_drvdata *ndd;
 	struct nd_label_id label_id;
@@ -964,7 +965,7 @@ static ssize_t __size_store(struct devic
 	u8 *uuid = NULL;
 	int rc, i;
 
-	if (dev->driver || to_ndns(dev)->claim)
+	if (dev->driver || ndns->claim)
 		return -EBUSY;
 
 	if (is_namespace_pmem(dev)) {
@@ -1034,20 +1035,16 @@ static ssize_t __size_store(struct devic
 
 		nd_namespace_pmem_set_resource(nd_region, nspm,
 				val * nd_region->ndr_mappings);
-	} else if (is_namespace_blk(dev)) {
-		struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
-
-		/*
-		 * Try to delete the namespace if we deleted all of its
-		 * allocation, this is not the seed device for the
-		 * region, and it is not actively claimed by a btt
-		 * instance.
-		 */
-		if (val == 0 && nd_region->ns_seed != dev
-				&& !nsblk->common.claim)
-			nd_device_unregister(dev, ND_ASYNC);
 	}
 
+	/*
+	 * Try to delete the namespace if we deleted all of its
+	 * allocation, this is not the seed device for the region, and
+	 * it is not actively claimed by a btt instance.
+	 */
+	if (val == 0 && nd_region->ns_seed != dev && !ndns->claim)
+		nd_device_unregister(dev, ND_ASYNC);
+
 	return rc;
 }
 

  parent reply	other threads:[~2017-01-24  8:00 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170124080037epcas2p270f8226e76503a60d8fcf6925a8c918b@epcas2p2.samsung.com>
2017-01-24  7:54 ` [PATCH 4.9 000/130] 4.9.6-stable review Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 001/130] IB/core: Release allocated memory in cache setup failure Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 002/130] IB/rxe: Increase max number of completions to 32k Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 003/130] IB/rxe: avoid putting a large struct rxe_qp on stack Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 004/130] IB/mlx5: Avoid system crash when enabling many VFs Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 005/130] IB/mlx5: Fix reported max SGE calculation Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 006/130] IB/mlx5: Assign SRQ type earlier Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 007/130] IB/mlx5: Wait for all async command completions to complete Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 008/130] IB/mlx4: Set traffic class in AH Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 009/130] IB/mlx4: Fix out-of-range array index in destroy qp flow Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 010/130] IB/mlx4: Handle well-known-gid in mad_demux processing Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 011/130] IB/mlx4: Fix port query for 56Gb Ethernet links Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 012/130] IB/mlx4: When no DMFS for IPoIB, dont allow NET_IF QPs Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 013/130] IB/mlx4: Check if GRH is available before using it Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 014/130] IB/IPoIB: Remove cant use GFP_NOIO warning Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 015/130] perf trace: Use the syscall raw_syscalls:sys_enter timestamp Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 016/130] perf mem: Fix --all-user/--all-kernel options Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 017/130] perf trace: Check if MAP_32BIT is defined (again) Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 018/130] perf diff: Do not overwrite valid build id Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 019/130] perf callchain: Fixup help/config for no-unwinding Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 020/130] perf scripting: Avoid leaking the scripting_context variable Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 021/130] perf jit: Enable jitdump support without dwarf Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 023/130] ARM: dts: r8a7794: Use SYSC "always-on" PM Domain for sound Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 024/130] ARM: dts: r8a7794: remove Z clock Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 025/130] ARM: dts: imx6q-cm-fx6: fix fec pinctrl Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 026/130] ARM: dts: imx31: fix clock control module interrupts description Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 028/130] ARM: dts: imx31: fix AVIC base address Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 029/130] ARM: dts: omap3: Add DTS for Logic PD SOM-LV 37xx Dev Kit Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 030/130] tmpfs: clear S_ISGID when setting posix ACLs Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 031/130] x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 032/130] rcu: Remove cond_resched() from Tiny synchronize_sched() Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 033/130] rcu: Narrow early boot window of illegal synchronous grace periods Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 034/130] sunrpc: dont call sleeping functions from the notifier block callbacks Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 035/130] svcrpc: dont leak contexts on PROC_DESTROY Greg Kroah-Hartman
2017-01-24  7:54   ` Greg Kroah-Hartman [this message]
2017-01-24  7:54   ` [PATCH 4.9 037/130] ARC: module: Fix !CONFIG_ARC_DW2_UNWIND builds Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 038/130] fuse: clear FR_PENDING flag when moving requests out of pending queue Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 039/130] fuse: fix time_to_jiffies nsec sanity check Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 040/130] PCI: designware: Check for iATU unroll only on platforms that use ATU Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 041/130] PCI: Enumerate switches below PCI-to-PCIe bridges Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 042/130] HID: corsair: fix DMA buffers on stack Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 043/130] HID: corsair: fix control-transfer error handling Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 044/130] mmc: sdhci-acpi: Only powered up enabled acpi child devices Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 045/130] mmc: mxs-mmc: Fix additional cycles after transmission stop Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 046/130] ieee802154: atusb: do not use the stack for buffers to make them DMA able Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 047/130] mtd: nand: lpc32xx: fix invalid error handling of a requested irq Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 048/130] mtd: nand: xway: disable module support Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 049/130] mtd: nand: xway: fix build because of module functions Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 050/130] KVM: s390: do not expose random data via facility bitmap Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 051/130] KVM: arm/arm64: vgic: Fix deadlock on error handling Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 052/130] powerpc/icp-opal: Fix missing KVM case and harden replay Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 053/130] powerpc/perf: Fix PM_BRU_CMPL event code for power9 Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 054/130] powerpc/ptrace: Preserve previous fprs/vsrs on short regset write Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 055/130] powerpc/ptrace: Preserve previous TM " Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 056/130] powerpc: Ignore reserved field in DCSR and PVR reads and writes Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 057/130] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 058/130] qla2xxx: Fix crash due to null pointer access Greg Kroah-Hartman
2017-01-24  7:54   ` [PATCH 4.9 059/130] mac80211: implement multicast forwarding on fast-RX path Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 060/130] ubifs: Fix journal replay wrt. xattr nodes Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 061/130] clocksource/exynos_mct: Clear interrupt when cpu is shut down Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 062/130] svcrdma: avoid duplicate dma unmapping during error recovery Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 063/130] ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 064/130] ibmvscsis: Fix sleeping in interrupt context Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 065/130] ibmvscsis: Fix max transfer length Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 066/130] ceph: fix bad endianness handling in parse_reply_info_extra Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 067/130] ARM: dts: OMAP5 / DRA7: indicate that SATA port 0 is available Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 068/130] ARM: dts: da850-evm: fix read access to SPI flash Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 069/130] arm64: avoid returning from bad_mode Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 070/130] arm64/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 071/130] arm64/ptrace: Preserve previous registers for short regset write - 2 Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 072/130] arm64/ptrace: Preserve previous registers for short regset write - 3 Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 073/130] arm64/ptrace: Avoid uninitialised struct padding in fpr_set() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 074/130] arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 076/130] libceph: ceph_x_encrypt_buflen() takes in_len Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 077/130] libceph: old_key in process_one_ticket() is redundant Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 078/130] libceph: introduce ceph_x_encrypt_offset() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 079/130] libceph: introduce ceph_crypt() for in-place en/decryption Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 080/130] libceph: rename and align ceph_x_authorizer::reply_buf Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 081/130] libceph: tweak calcu_signature() a little Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 082/130] libceph: switch ceph_x_encrypt() to ceph_crypt() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 083/130] libceph: switch ceph_x_decrypt() " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 084/130] libceph: remove now unused ceph_*{en,de}crypt*() functions Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 085/130] ARM: dts: dra7: Add an empty chosen node to top level DTSI Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 086/130] ARM: dts: dm816x: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 087/130] ARM: dts: dm814x: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 088/130] ARM: dts: am33xx: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 089/130] ARM: dts: omap4: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 090/130] ARM: dts: omap5: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 091/130] ARM: dts: am4372: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 092/130] ARM: dts: omap3: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 093/130] ARM: dts: omap2: " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 094/130] ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 095/130] ARM: dts: omap3: Fix Card Detect and Write Protect on Logic PD SOM-LV Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 096/130] ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 097/130] ARM: 8613/1: Fix the uaccess crash on PB11MPCore Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 098/130] ceph: fix scheduler warning due to nested blocking Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 099/130] ceph: fix ceph_get_caps() interruption Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 100/130] ceph: fix endianness of getattr mask in ceph_d_revalidate Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 101/130] ceph: fix endianness bug in frag_tree_split_cmp Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 102/130] libceph: make sure ceph_aes_crypt() IV is aligned Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 103/130] xprtrdma: Make FRWR send queue entry accounting more accurate Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 104/130] xprtrdma: Squelch "max send, max recv" messages at connect time Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 105/130] arm64: mm: avoid name clash in __page_to_voff() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 106/130] arm64: Fix swiotlb fallback allocation Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 107/130] swiotlb: Convert swiotlb_force from int to enum Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 108/130] swiotlb: Add swiotlb=noforce debug option Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 109/130] scsi: ses: Fix SAS device detection in enclosure Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 110/130] scsi: mpt3sas: fix hang on ata passthrough commands Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 111/130] PM / devfreq: exynos-bus: Fix the wrong return value Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 112/130] PM / devfreq: Fix the bug of devfreq_add_device when governor is NULL Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 113/130] mtd: spi-nor: Off by one in cqspi_setup_flash() Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 114/130] mtd: spi-nor: Fix some error codes " Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 115/130] rpmsg: virtio_rpmsg_bus: fix channel creation Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 116/130] [media] blackfin: check devm_pinctrl_get() for errors Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 117/130] [media] platform: pxa_camera: add VIDEO_V4L2 dependency Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 118/130] [media] gs1662: drop kfree for memory allocated with devm_kzalloc Greg Kroah-Hartman
2017-01-24  7:55   ` [PATCH 4.9 119/130] [media] ite-cir: initialize use_demodulator before using it Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 120/130] [media] st-hva: fix some error handling in hva_hw_probe() Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 122/130] [media] s5p-mfc: Fix clock management in s5p_mfc_release() function Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 124/130] dmaengine: pl330: Fix runtime PM support for terminated transfers Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 125/130] spi: pxa2xx: add missed break Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 126/130] soc: ti: wkup_m3_ipc: Fix error return code in wkup_m3_ipc_probe() Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 127/130] selftest/powerpc: Wrong PMC initialized in pmc56_overflow test Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 128/130] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 129/130] libceph: uninline ceph_crypto_key_destroy() Greg Kroah-Hartman
2017-01-24  7:56   ` [PATCH 4.9 130/130] libceph: stop allocating a new cipher on every crypto request Greg Kroah-Hartman
2017-01-24 18:26   ` [PATCH 4.9 000/130] 4.9.6-stable review Shuah Khan
2017-01-25 11:02     ` Greg Kroah-Hartman
2017-01-24 19:07   ` Guenter Roeck
2017-01-25 11:02     ` 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=20170124075536.434300398@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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).