Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3874914pxb; Tue, 17 Nov 2020 05:59:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQNeSWC3vah0qJcQtdG81AgcQJTBaffHO3kQI5+QzoC7QEwbnmZkLAmA0H89MFIV33LKMn X-Received: by 2002:a50:daca:: with SMTP id s10mr12385153edj.263.1605621573401; Tue, 17 Nov 2020 05:59:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605621573; cv=none; d=google.com; s=arc-20160816; b=Nu0kyEuHc5m2471SoOzHIvMlH/0/J5SJ+z6aYce9bAdtRstJ5ioeuyNjOuWJ8reK7C 236OfYO50YTVfKLaQ7x+iG7fLdz+4zgJUwmtlomKT9/a5QcgSIjZDckn2IdVDQcvJlpk poINNn7UMrtuXaNm2N8Zihudu2NUMarNJMGsBGxdPzrSkaavDQzgZ+g8yzO69dTHSfuV dWJkqNgeWkDkvFcbe3dCZe2RANBttwn9s64Keja3PW02NMbHH6SZllre9/RwcdudRZVy j2v1Y4AGKdG0PrPDXCWy5ghbPRVfwnX59n5YuyzNol46UJXAffNSUWtF6vu4fgUvedbK q0lg== 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=A75F4c9gwlSH6ASTTlCS0wWfeVap0OLOHuA5UKsLPfo=; b=GFEy38Px8JBbopur/SJz0LcuQhdqOynmy7lo/LJpIeq/cAUDPP7mKIhiEBr8oZk+pr Lko+mbq1yculkuFuSaGLUXLHYMToqmcUFdkV2lV1avoBPUCD9wBD6kIt0r5b7CfpYUse IdnfQXlwL9LKc8WXBmOfNG7T1UgXPP1lr3cWSCjgctOZMbziBQXBy/6rqt6iSLjhXywm +84V0cblNSIwX/8gYZ8d2SQ18Yk4xTKfBOP9t4uE8Bg76ApQwzy1m7N6saXo6777mPcX c+CjyIogjO0MLWVaKjTqe5eHky46r++uigr82inj1IXg/y0wDediADbrXhDzwAjB4z+k aDew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zmSwaz8+; 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 g24si1555292edj.168.2020.11.17.05.59.10; Tue, 17 Nov 2020 05:59:33 -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=zmSwaz8+; 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 S1729893AbgKQNTs (ORCPT + 99 others); Tue, 17 Nov 2020 08:19:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:52568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730415AbgKQNTd (ORCPT ); Tue, 17 Nov 2020 08:19:33 -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 F05B1206D5; Tue, 17 Nov 2020 13:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619173; bh=1JM3XUMBgFSq2lQJHO/MI3V8t3AmxGTiwB7rTLk1RKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zmSwaz8+F2G17+NLaJNLJDefnDnjDzDrGgliw8LaIRaut84kIeOY+jh8rw1qtlbqK ohGkGFbfbxwJMtNsuhtTy9YjGCaxC4Tl36KQzQS6mpUVMiNiFUX3Upf5tnStLiBCwL 99W0Wr93ds5sA5s3QJP7pKVnjfKrrL8vNQrgnvFk= 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 4.19 053/101] nbd: fix a block_device refcount leak in nbd_release Date: Tue, 17 Nov 2020 14:05:20 +0100 Message-Id: <20201117122115.680231335@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@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 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