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, "Javier González" <javier@cnexlabs.com>,
	"Matias Bjørling" <m@bjorling.me>, "Jens Axboe" <axboe@kernel.dk>,
	"Sudip Mukherjee" <sudipm.mukherjee@gmail.com>
Subject: [PATCH 4.14 098/115] lightnvm: pblk: free padded entries in write buffer
Date: Thu, 13 Sep 2018 15:31:58 +0200	[thread overview]
Message-ID: <20180913131829.449589335@linuxfoundation.org> (raw)
In-Reply-To: <20180913131823.327472833@linuxfoundation.org>

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

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

From: Javier González <javier@cnexlabs.com>

commit cd8ddbf7a5e206fe6995ab0aee245d597dd6a7f2 upstream.

When a REQ_FLUSH reaches pblk, the bio cannot be directly completed.
Instead, data on the write buffer is flushed and the bio is completed on
the completion pah. This might require some sectors to be padded in
order to guarantee a successful write.

This patch fixes a memory leak on the padded pages. A consequence of
this bad free was that internal bios not containing data (only a flush)
were not being completed.

Fixes: a4bd217b4326 ("lightnvm: physical block device (pblk) target")
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/lightnvm/pblk-core.c  |    1 -
 drivers/lightnvm/pblk-write.c |    7 ++++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -190,7 +190,6 @@ void pblk_bio_free_pages(struct pblk *pb
 
 	WARN_ON(off + nr_pages != bio->bi_vcnt);
 
-	bio_advance(bio, off * PBLK_EXPOSED_PAGE_SIZE);
 	for (i = off; i < nr_pages + off; i++) {
 		bv = bio->bi_io_vec[i];
 		mempool_free(bv.bv_page, pblk->page_bio_pool);
--- a/drivers/lightnvm/pblk-write.c
+++ b/drivers/lightnvm/pblk-write.c
@@ -33,6 +33,10 @@ static unsigned long pblk_end_w_bio(stru
 			bio_endio(original_bio);
 	}
 
+	if (c_ctx->nr_padded)
+		pblk_bio_free_pages(pblk, rqd->bio, c_ctx->nr_valid,
+							c_ctx->nr_padded);
+
 #ifdef CONFIG_NVM_DEBUG
 	atomic_long_add(c_ctx->nr_valid, &pblk->sync_writes);
 #endif
@@ -521,7 +525,8 @@ static void pblk_free_write_rqd(struct p
 	struct bio *bio = rqd->bio;
 
 	if (c_ctx->nr_padded)
-		pblk_bio_free_pages(pblk, bio, rqd->nr_ppas, c_ctx->nr_padded);
+		pblk_bio_free_pages(pblk, bio, c_ctx->nr_valid,
+							c_ctx->nr_padded);
 }
 
 static int pblk_submit_write(struct pblk *pblk)



  parent reply	other threads:[~2018-09-13 13:50 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-13 13:30 [PATCH 4.14 000/115] 4.14.70-stable review Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 001/115] act_ife: fix a potential use-after-free Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 002/115] ipv4: tcp: send zero IPID for RST and ACK sent in SYN-RECV and TIME-WAIT state Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 003/115] net: bcmgenet: use MAC link status for fixed phy Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 004/115] net: macb: do not disable MDIO bus at open/close time Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 005/115] net: sched: Fix memory exposure from short TCA_U32_SEL Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 006/115] qlge: Fix netdev features configuration Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 007/115] r8169: add support for NCube 8168 network card Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 008/115] tcp: do not restart timewait timer on rst reception Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 009/115] vti6: remove !skb->ignore_df check from vti6_xmit() Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 010/115] net/sched: act_pedit: fix dump of extended layered op Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 011/115] tipc: fix a missing rhashtable_walk_exit() Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 012/115] nfp: wait for posted reconfigs when disabling the device Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 013/115] sctp: hold transport before accessing its asoc in sctp_transport_get_next Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 014/115] mlxsw: spectrum_switchdev: Do not leak RIFs when removing bridge Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 015/115] vhost: correctly check the iova range when waking virtqueue Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 016/115] hv_netvsc: ignore devices that are not PCI Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 017/115] hv_netvsc: Fix a deadlock by getting rtnl lock earlier in netvsc_probe() Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 018/115] act_ife: move tcfa_lock down to where necessary Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 019/115] act_ife: fix a potential deadlock Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 020/115] net: sched: action_ife: take reference to meta module Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 021/115] cifs: check if SMB2 PDU size has been padded and suppress the warning Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 022/115] hfsplus: dont return 0 when fill_super() failed Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 023/115] hfs: prevent crash on exit from failed search Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 024/115] sunrpc: Dont use stack buffer with scatterlist Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 025/115] fork: dont copy inconsistent signal handler state to child Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 026/115] reiserfs: change j_timestamp type to time64_t Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 027/115] hfsplus: fix NULL dereference in hfsplus_lookup() Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 028/115] fs/proc/kcore.c: use __pa_symbol() for KCORE_TEXT list entries Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 029/115] fat: validate ->i_start before using Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 030/115] scripts: modpost: check memory allocation results Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 031/115] virtio: pci-legacy: Validate queue pfn Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 032/115] x86/mce: Add notifier_block forward declaration Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 033/115] IB/hfi1: Invalid NUMA node information can cause a divide by zero Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 034/115] pwm: meson: Fix mux clock names Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 035/115] mm/fadvise.c: fix signed overflow UBSAN complaint Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 036/115] fs/dcache.c: fix kmemcheck splat at take_dentry_name_snapshot() Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 037/115] platform/x86: intel_punit_ipc: fix build errors Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 038/115] netfilter: ip6t_rpfilter: set F_IFACE for linklocal addresses Greg Kroah-Hartman
2018-09-13 13:30 ` [PATCH 4.14 039/115] s390/kdump: Fix memleak in nt_vmcoreinfo Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 040/115] ipvs: fix race between ip_vs_conn_new() and ip_vs_del_dest() Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 041/115] mfd: sm501: Set coherent_dma_mask when creating subdevices Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 042/115] platform/x86: asus-nb-wmi: Add keymap entry for lid flip action on UX360 Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 043/115] netfilter: fix memory leaks on netlink_dump_start error Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 044/115] tcp, ulp: add alias for all ulp modules Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 045/115] RDMA/hns: Fix usage of bitmap allocation functions return values Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 046/115] net: hns3: Fix for command format parsing error in hclge_is_all_function_id_zero Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 047/115] net: hns3: Fix for phy link issue when using marvell phy driver Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 048/115] perf tools: Check for null when copying nsinfo Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 049/115] irqchip/bcm7038-l1: Hide cpu offline callback when building for !SMP Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 050/115] net/9p/trans_fd.c: fix race by holding the lock Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 051/115] net/9p: fix error path of p9_virtio_probe Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 052/115] f2fs: fix to clear PG_checked flag in set_page_dirty() Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 053/115] powerpc/uaccess: Enable get_user(u64, *p) on 32-bit Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 054/115] powerpc: Fix size calculation using resource_size() Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 055/115] perf probe powerpc: Fix trace event post-processing Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 056/115] block: bvec_nr_vecs() returns value for wrong slab Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 057/115] s390/dasd: fix hanging offline processing due to canceled worker Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 058/115] s390/dasd: fix panic for failed online processing Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 059/115] ACPI / scan: Initialize status to ACPI_STA_DEFAULT Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 060/115] scsi: aic94xx: fix an error code in aic94xx_init() Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 061/115] NFSv4: Fix error handling in nfs4_sp4_select_mode() Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 062/115] Input: do not use WARN() in input_alloc_absinfo() Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 063/115] xen/balloon: fix balloon initialization for PVH Dom0 Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 064/115] PCI: mvebu: Fix I/O space end address calculation Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 065/115] dm kcopyd: avoid softlockup in run_complete_job Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 066/115] staging: comedi: ni_mio_common: fix subdevice flags for PFI subdevice Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 067/115] ASoC: rt5677: Fix initialization of rt5677_of_match.data Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 068/115] iommu/omap: Fix cache flushes on L2 table entries Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 069/115] selftests/powerpc: Kill child processes on SIGINT Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 070/115] RDS: IB: fix passing zero to ERR_PTR() warning Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 071/115] cfq: Suppress compiler warnings about comparisons Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 072/115] smb3: fix reset of bytes read and written stats Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 073/115] SMB3: Number of requests sent should be displayed for SMB3 not just CIFS Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 074/115] powerpc/platforms/85xx: fix t1042rdb_diu.c build errors & warning Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 075/115] powerpc/64s: Make rfi_flush_fallback a little more robust Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 076/115] powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 077/115] clk: rockchip: Add pclk_rkpwm_pmu to PMU critical clocks in rk3399 Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 078/115] KVM: vmx: track host_state.loaded using a loaded_vmcs pointer Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 079/115] kvm: nVMX: Fix fault vector for VMX operation at CPL > 0 Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 080/115] btrfs: Exit gracefully when chunk map cannot be inserted to the tree Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 081/115] btrfs: replace: Reset on-disk dev stats value after replace Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 082/115] btrfs: relocation: Only remove reloc rb_trees if reloc control has been initialized Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 083/115] btrfs: Dont remove block group that still has pinned down bytes Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 084/115] arm64: rockchip: Force CONFIG_PM on Rockchip systems Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 085/115] ARM: " Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 086/115] drm/i915/lpe: Mark LPE audio runtime pm as "no callbacks" Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 087/115] drm/amdgpu: Fix RLC safe mode test in gfx_v9_0_enter_rlc_safe_mode Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 088/115] drm/amd/pp/Polaris12: Fix a chunk of registers missed to program Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 089/115] drm/edid: Add 6 bpc quirk for SDC panel in Lenovo B50-80 Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 090/115] drm/amdgpu: update tmr mc address Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 091/115] drm/amdgpu:add tmr mc address into amdgpu_firmware_info Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 092/115] drm/amdgpu:add new firmware id for VCN Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 093/115] drm/amdgpu:add VCN support in PSP driver Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 094/115] drm/amdgpu:add VCN booting with firmware loaded by PSP Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 095/115] uapi/linux/keyctl.h: dont use C++ reserved keyword as a struct member name Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 096/115] debugobjects: Make stack check warning more informative Greg Kroah-Hartman
2018-09-13 13:31 ` [PATCH 4.14 097/115] sched/deadline: Fix switching to -deadline Greg Kroah-Hartman
2018-09-13 13:31 ` Greg Kroah-Hartman [this message]
2018-09-13 13:31 ` [PATCH 4.14 099/115] mm: Fix devm_memremap_pages() collision handling Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 100/115] HID: add quirk for another PIXART OEM mouse used by HP Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 101/115] usb: dwc3: core: Fix ULPI PHYs and prevent phy_get/ulpi_init during suspend/resume Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 102/115] x86/pae: use 64 bit atomic xchg function in native_ptep_get_and_clear Greg Kroah-Hartman
2018-09-13 14:55   ` Jason Andryuk
2018-09-13 15:56     ` [PATCH 4.14] " Jason Andryuk
2018-09-13 17:17       ` Greg KH
2018-09-13 13:32 ` [PATCH 4.14 103/115] x86/xen: dont write ptes directly in 32-bit PV guests Greg Kroah-Hartman
2018-09-14 17:12   ` Eduardo Valentin
2018-09-14 18:19     ` Greg Kroah-Hartman
2018-09-14 18:57       ` Eduardo Valentin
2018-09-13 13:32 ` [PATCH 4.14 104/115] drm/i915: Increase LSPCON timeout Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 105/115] kbuild: make missing $DEPMOD a Warning instead of an Error Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 106/115] s390/lib: use expoline for all bcr instructions Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 107/115] irda: Fix memory leak caused by repeated binds of irda socket Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 108/115] irda: Only insert new objects into the global database via setsockopt Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 109/115] Revert "ARM: imx_v6_v7_defconfig: Select ULPI support" Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 110/115] kvm: x86: Set highest physical address bits in non-present/reserved SPTEs Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 111/115] x86: kvm: avoid unused variable warning Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 112/115] arm64: cpu_errata: include required headers Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 113/115] ASoC: wm8994: Fix missing break in switch Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 114/115] arm64: Fix mismatched cache line size detection Greg Kroah-Hartman
2018-09-13 13:32 ` [PATCH 4.14 115/115] arm64: Handle mismatched cache type Greg Kroah-Hartman
2018-09-13 19:10 ` [PATCH 4.14 000/115] 4.14.70-stable review Nathan Chancellor
2018-09-13 20:11   ` Greg Kroah-Hartman
2018-09-14 12:39 ` Naresh Kamboju
2018-09-14 14:54 ` Guenter Roeck
2018-09-14 22:47 ` Eduardo Valentin
2018-09-15  7:15   ` 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=20180913131829.449589335@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=axboe@kernel.dk \
    --cc=javier@cnexlabs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m@bjorling.me \
    --cc=stable@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.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).