Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1114351imm; Wed, 1 Aug 2018 10:24:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfzNdNKDV1Vo8yxan6iHP8iPPuvhpemkEGOGxtXdR2OVaRcGNucYcRIE9xhKZcrLPOAD1oT X-Received: by 2002:a17:902:b785:: with SMTP id e5-v6mr25468505pls.339.1533144294745; Wed, 01 Aug 2018 10:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144294; cv=none; d=google.com; s=arc-20160816; b=IUhS1pRjJdF2fmhx9Gq3DhrrCQ1Rti3gQC/5swu8KA0lgjvYpFuipjrrNi4p2Q3LvR wGRtGDOjVL12buUEXrhI2iNb8CqsppxOrcYD67bdws4cBrT8BaKAsUgNigSyYq9uAnL3 bK0Oerrz799ZZoJ9hDI6ftCXRPc0mMWPlDwfh3yu5tvPorX9UpVGK3AxGB/oTrC8HHUD E2srQZjMjmarr5hnqBbNWgUK5nB+3mQrZhxo1Ih76E4YzSDQSBhwygTKUbqT7TE5eXhZ 322lyudWYi60xRWaW/3apQjKOZ9eh89eNj0XTTajI0KvJYX4qMDcfPTGDC1LmrwZsCtO fUcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TqtK6oHknxw2V9hiEnglWQkDNHgLN6q4SzpKnj1FBHc=; b=L2WwMn89oB+nhtqTKLChHV0L1pBlUMKOKi1Z7iXRr27qNvS+AgX7m7pwwCVglylMHK jW0YUiZ9D1qFNbMfUGtjet/adOktH3KYjTuGj38f9jzknva89AiXchpOI6sHbU58EyGb OJpGSBJqVtO1jHRUUBTjfMZP26Gnt64RlfwF0xSjwEHtNtjSRaTz8zmbWRvlorld4nk+ sCisktZm/ADTiq8jZ/ImF5UOon4bZsKbcoaZL0dj2ymWsJCfE7f1fwvVusVBRjbckUib lEPirMfSNRu1Qx8QMJDs6fpEsSDAO+akhGIKKNm2xEMHpw30TwjPmfH9VNtqkFyxkbTO Resw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si14157439plk.97.2018.08.01.10.24.40; Wed, 01 Aug 2018 10:24:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405155AbeHATJW (ORCPT + 99 others); Wed, 1 Aug 2018 15:09:22 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:50758 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389759AbeHATJV (ORCPT ); Wed, 1 Aug 2018 15:09:21 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AD9A4CC3; Wed, 1 Aug 2018 17:22:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Lei , Hannes Reinecke , Christoph Hellwig , Martin Wilck , Jens Axboe Subject: [PATCH 4.14 216/246] blkdev: __blkdev_direct_IO_simple: fix leak in error case Date: Wed, 1 Aug 2018 18:52:06 +0200 Message-Id: <20180801165022.052181579@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Wilck commit 9362dd1109f87a9d0a798fbc890cb339c171ed35 upstream. Fixes: 72ecad22d9f1 ("block: support a full bio worth of IO for simplified bdev direct-io") Reviewed-by: Ming Lei Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Signed-off-by: Martin Wilck Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- fs/block_dev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -231,7 +231,7 @@ __blkdev_direct_IO_simple(struct kiocb * ret = bio_iov_iter_get_pages(&bio, iter); if (unlikely(ret)) - return ret; + goto out; ret = bio.bi_iter.bi_size; if (iov_iter_rw(iter) == READ) { @@ -260,12 +260,13 @@ __blkdev_direct_IO_simple(struct kiocb * put_page(bvec->bv_page); } - if (vecs != inline_vecs) - kfree(vecs); - if (unlikely(bio.bi_status)) ret = blk_status_to_errno(bio.bi_status); +out: + if (vecs != inline_vecs) + kfree(vecs); + bio_uninit(&bio); return ret;