Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3869881pxb; Tue, 17 Nov 2020 05:50:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuZPMJUkEvbvw9gK6LASBVgZW8ROW6yoiwnOJcZIg3D7bkwtSxl8lsfjvmbOX1LSQBvrIR X-Received: by 2002:aa7:d891:: with SMTP id u17mr12077218edq.180.1605621059568; Tue, 17 Nov 2020 05:50:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621059; cv=none; d=google.com; s=arc-20160816; b=tKgurAU00WZUOnLe4698AVgtHAh4NOHFR0Smm9f8voPAGY3eiH41P5CHAUrq2ctyro 62BkOXj2cYVXPnDOjR5neiw+YiMbFX+dX4UGdejPgvMG6J5tXrg1zsHJcN346IKgqyAe lmKMuwEAWLjaMPv1XimkzNOZYPayhVjRXtzp/zpnNiMMJssQsfHFLt/+7fDmIrswRyQi Cx2dlJDcN96cqQVJfni4gZpIgr3OBiawPQrSv/zrmzuz9EHh49rRwlE21HmaG2ctwNK7 uLyxNbZdfy7W46LO+1VeRKtQ/r5slGp6hO2BXswIPAaYeqm4kUEWvWNqKPR3Hd6pP+e6 OVfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=82z5PG7obR0Z+owhlzcQzFpycR/liZW7gw6Oay7G2N0=; b=v3GKWxSwwNh7M5H51PV5/Nc9o7AfBzYCVfPIyFMBcx8rpQsuGlKz6DxAl14zoMgA9H 7uAfJFYQ4VQMKaANhflFMV8KSybmhu1sS8+7YaZoW73HtzMJIUZvI5nTUutiQvCN4HVU QO5YrcktuqUS1qM7bt9NCqOTm8EXhPJXehPD8DzVJ9IqmN01GQ9XEjVekBpH4nih8Hup hhzY8iTEUMb8VQor55pXG7p33OE/BeCPVfkxO1dl6jty/Mh/xz8BUsc3kCuH0Xwi8Ph8 hY1g8iX350gbeuj4u4sS7wYPIv8pzSiuK0FmdIw7vGovWJegmN09fzXDVWXs7SXQBiFf dFHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f5NKfF2l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oa23si1246580ejb.707.2020.11.17.05.50.35; Tue, 17 Nov 2020 05:50:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f5NKfF2l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733135AbgKQNrE (ORCPT + 99 others); Tue, 17 Nov 2020 08:47:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:48422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732947AbgKQNhX (ORCPT ); Tue, 17 Nov 2020 08:37:23 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 70A5F20870; Tue, 17 Nov 2020 13:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620243; bh=eioIBJxLKiEpJRcB3ViW2s8x0ek8thK0oEexwvMsF8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f5NKfF2l9k+JbvJSaD0/YB7gcohuAqBN2eu1IK5WeyMq7UsKCrFlungUbtMgVF2bI qEZefMY63nKhRKaI8vQqTBYlRlGeatPxPmjMy9HpoqAZw+Rf6Vs3JWFHxvRHYsojY9 HHT+r696FizQs0ad1vvqTDxkrlRVeByBEtWbUUhw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Josef Bacik , Jens Axboe , Sasha Levin Subject: [PATCH 5.9 152/255] nbd: fix a block_device refcount leak in nbd_release Date: Tue, 17 Nov 2020 14:04:52 +0100 Message-Id: <20201117122146.365344112@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ 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 Reviewed-by: Josef Bacik Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index d76fca629c143..36c46fe078556 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1517,6 +1517,7 @@ static void nbd_release(struct gendisk *disk, fmode_t mode) if (test_bit(NBD_RT_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