stable.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, Christoph Hellwig <hch@lst.de>,
	Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 053/101] nbd: fix a block_device refcount leak in nbd_release
Date: Tue, 17 Nov 2020 14:05:20 +0100	[thread overview]
Message-ID: <20201117122115.680231335@linuxfoundation.org> (raw)
In-Reply-To: <20201117122113.128215851@linuxfoundation.org>

From: Christoph Hellwig <hch@lst.de>

[ Upstream commit 2bd645b2d3f0bacadaa6037f067538e1cd4e42ef ]

bdget_disk needs to be paired with bdput to not leak a reference
on the block device inode.

Fixes: 08ba91ee6e2c ("nbd: Add the nbd NBD_DISCONNECT_ON_CLOSE config flag.")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 706115ecd9bee..517318bb350cf 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1448,6 +1448,7 @@ static void nbd_release(struct gendisk *disk, fmode_t mode)
 	if (test_bit(NBD_DISCONNECT_ON_CLOSE, &nbd->config->runtime_flags) &&
 			bdev->bd_openers == 0)
 		nbd_disconnect_and_put(nbd);
+	bdput(bdev);
 
 	nbd_config_put(nbd);
 	nbd_put(nbd);
-- 
2.27.0




  parent reply	other threads:[~2020-11-17 13:19 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 13:04 [PATCH 4.19 000/101] 4.19.158-rc1 review Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 001/101] regulator: defer probe when trying to get voltage from unresolved supply Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 002/101] time: Prevent undefined behaviour in timespec64_to_ns() Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 003/101] nbd: dont update block size after device is started Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 004/101] usb: dwc3: gadget: Continue to process pending requests Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 005/101] usb: dwc3: gadget: Reclaim extra TRBs after request completion Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 006/101] btrfs: sysfs: init devices outside of the chunk_mutex Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 007/101] btrfs: reschedule when cloning lots of extents Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 008/101] genirq: Let GENERIC_IRQ_IPI select IRQ_DOMAIN_HIERARCHY Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 009/101] hv_balloon: disable warning when floor reached Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 010/101] net: xfrm: fix a race condition during allocing spi Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 011/101] xfs: set xefi_discard when creating a deferred agfl free log intent item Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 012/101] netfilter: ipset: Update byte and packet counters regardless of whether they match Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 013/101] perf tools: Add missing swap for ino_generation Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 014/101] ALSA: hda: prevent undefined shift in snd_hdac_ext_bus_get_link() Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 015/101] can: rx-offload: dont call kfree_skb() from IRQ context Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 016/101] can: dev: can_get_echo_skb(): prevent call to kfree_skb() in hard " Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 017/101] can: dev: __can_get_echo_skb(): fix real payload length return value for RTR frames Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 018/101] can: can_create_echo_skb(): fix echo skb generation: always use skb_clone() Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 019/101] can: peak_usb: add range checking in decode operations Greg Kroah-Hartman
2020-11-18 22:05   ` Pavel Machek
2020-11-17 13:04 ` [PATCH 4.19 020/101] can: peak_usb: peak_usb_get_ts_time(): fix timestamp wrapping Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 021/101] can: peak_canfd: pucan_handle_can_rx(): fix echo management when loopback is on Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 022/101] can: flexcan: remove FLEXCAN_QUIRK_DISABLE_MECR quirk for LS1021A Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 023/101] xfs: flush new eof page on truncate to avoid post-eof corruption Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 024/101] xfs: fix scrub flagging rtinherit even if there is no rt device Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 025/101] tpm: efi: Dont create binary_bios_measurements file for an empty log Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 026/101] Btrfs: fix missing error return if writeback for extent buffer never started Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 027/101] ath9k_htc: Use appropriate rs_datalen type Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 028/101] netfilter: use actual socket sk rather than skb sk when routing harder Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 029/101] crypto: arm64/aes-modes - get rid of literal load of addend vector Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 030/101] usb: gadget: goku_udc: fix potential crashes in probe Greg Kroah-Hartman
2020-11-17 13:04 ` [PATCH 4.19 031/101] ALSA: hda: Reinstate runtime_allow() for all hda controllers Greg Kroah-Hartman
2020-11-18 10:43   ` Pavel Machek
2020-11-18 13:40     ` Sasha Levin
2020-11-17 13:04 ` [PATCH 4.19 032/101] gfs2: Free rd_bits later in gfs2_clear_rgrpd to fix use-after-free Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 033/101] gfs2: Add missing truncate_inode_pages_final for sd_aspace Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 034/101] gfs2: check for live vs. read-only file system in gfs2_fitrim Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 035/101] scsi: hpsa: Fix memory leak in hpsa_init_one() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 036/101] drm/amdgpu: perform srbm soft reset always on SDMA resume Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 037/101] drm/amd/pm: perform SMC reset on suspend/hibernation Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 038/101] drm/amd/pm: do not use ixFEATURE_STATUS for checking smc running Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 039/101] mac80211: fix use of skb payload instead of header Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 040/101] mac80211: always wind down STA state Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 041/101] cfg80211: regulatory: Fix inconsistent format argument Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 042/101] scsi: scsi_dh_alua: Avoid crash during alua_bus_detach() Greg Kroah-Hartman
2020-11-18 22:17   ` Pavel Machek
2020-11-17 13:05 ` [PATCH 4.19 043/101] iommu/amd: Increase interrupt remapping table limit to 512 entries Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 044/101] s390/smp: move rcu_cpu_starting() earlier Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 045/101] vfio: platform: fix reference leak in vfio_platform_open Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 046/101] selftests: proc: fix warning: _GNU_SOURCE redefined Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 047/101] tpm_tis: Disable interrupts on ThinkPad T490s Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 048/101] tick/common: Touch watchdog in tick_unfreeze() on all CPUs Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 049/101] mfd: sprd: Add wakeup capability for PMIC IRQ Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 050/101] pinctrl: intel: Set default bias in case no particular value given Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 051/101] ARM: 9019/1: kprobes: Avoid fortify_panic() when copying optprobe template Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 052/101] pinctrl: aspeed: Fix GPI only function problem Greg Kroah-Hartman
2020-11-17 13:05 ` Greg Kroah-Hartman [this message]
2020-11-17 13:05 ` [PATCH 4.19 054/101] xfs: fix flags argument to rmap lookup when converting shared file rmaps Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 055/101] xfs: set the unwritten bit in rmap lookup flags in xchk_bmap_get_rmapextents Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 056/101] xfs: fix rmap key and record comparison functions Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 057/101] xfs: fix brainos in the refcount scrubbers rmap fragment processor Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 058/101] lan743x: fix "BUG: invalid wait context" when setting rx mode Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 059/101] xfs: fix a missing unlock on error in xfs_fs_map_blocks Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 060/101] of/address: Fix of_node memory leak in of_dma_is_coherent Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 061/101] cosa: Add missing kfree in error path of cosa_write Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 062/101] perf: Fix get_recursion_context() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 063/101] ext4: correctly report "not supported" for {usr,grp}jquota when !CONFIG_QUOTA Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 064/101] ext4: unlock xattr_sem properly in ext4_inline_data_truncate() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 065/101] btrfs: ref-verify: fix memory leak in btrfs_ref_tree_mod Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 066/101] btrfs: dev-replace: fail mount if we dont have replace item with target device Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 067/101] thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 068/101] thunderbolt: Add the missed ida_simple_remove() in ring_request_msix() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 069/101] uio: Fix use-after-free in uio_unregister_device() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 070/101] usb: cdc-acm: Add DISABLE_ECHO for Renesas USB Download mode Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 071/101] xhci: hisilicon: fix refercence leak in xhci_histb_probe Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 072/101] mei: protect mei_cl_mtu from null dereference Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 073/101] futex: Dont enable IRQs unconditionally in put_pi_state() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 074/101] ocfs2: initialize ip_next_orphan Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 075/101] btrfs: fix potential overflow in cluster_pages_for_defrag on 32bit arch Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 076/101] selinux: Fix error return code in sel_ib_pkey_sid_slow() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 077/101] gpio: pcie-idio-24: Fix irq mask when masking Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 078/101] gpio: pcie-idio-24: Fix IRQ Enable Register value Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 079/101] gpio: pcie-idio-24: Enable PEX8311 interrupts Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 080/101] mmc: renesas_sdhi_core: Add missing tmio_mmc_host_free() at remove Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 081/101] dont dump the threads that had been already exiting when zapped Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 082/101] drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[] Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 083/101] pinctrl: amd: use higher precision for 512 RtcClk Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 084/101] pinctrl: amd: fix incorrect way to disable debounce filter Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 085/101] erofs: derive atime instead of leaving it empty Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 086/101] swiotlb: fix "x86: Dont panic if can not alloc buffer for swiotlb" Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 087/101] IPv6: Set SIT tunnel hard_header_len to zero Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 088/101] net/af_iucv: fix null pointer dereference on shutdown Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 089/101] net: Update window_clamp if SOCK_RCVBUF is set Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 090/101] net/x25: Fix null-ptr-deref in x25_connect Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 091/101] tipc: fix memory leak in tipc_topsrv_start() Greg Kroah-Hartman
2020-11-17 13:05 ` [PATCH 4.19 092/101] vrf: Fix fast path output packet handling with async Netfilter rules Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 093/101] r8169: fix potential skb double free in an error path Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 094/101] random32: make prandom_u32() output unpredictable Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 095/101] x86/speculation: Allow IBPB to be conditionally enabled on CPUs with always-on STIBP Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 096/101] perf scripting python: Avoid declaring function pointers with a visibility attribute Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 097/101] perf/core: Fix race in the perf_mmap_close() function Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 098/101] Revert "kernel/reboot.c: convert simple_strtoul to kstrtoint" Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 099/101] reboot: fix overflow parsing reboot cpu number Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 100/101] net: sch_generic: fix the missing new qdisc assignment bug Greg Kroah-Hartman
2020-11-17 13:06 ` [PATCH 4.19 101/101] Convert trailing spaces and periods in path components Greg Kroah-Hartman
2020-11-17 19:09 ` [PATCH 4.19 000/101] 4.19.158-rc1 review Jon Hunter
2020-11-17 22:05 ` Shuah Khan
2020-11-18  7:57 ` Naresh Kamboju
2020-11-18 15:23 ` Guenter Roeck

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=20201117122115.680231335@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@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).