Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp445527ybg; Mon, 1 Jun 2020 05:43:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQQ6RlcxEbRLZKanHc2XARMdDALpJWtGyALsvMSqfmK9kYM0coss+U5h684JPt1ISbFqlL X-Received: by 2002:a17:906:14db:: with SMTP id y27mr19946993ejc.427.1591015408353; Mon, 01 Jun 2020 05:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591015408; cv=none; d=google.com; s=arc-20160816; b=O+IWSl4bA+eHc00MHirN7G3hB2AIazlqVOmDMsZk+m5c5/SFy5qKSYRU1QBTwhV8HT x/4sAwvFN47LE/Yr1/FWtBL8z6+9xxMIfOHPata7MjF49tK2Yls+vm/bjC7cU/QwVo1Q U1q5qH2rQXx2RxjYV+1f2xdZh8ccm0y9GqDnE+kVEQ2c2kFf010gkBNHFWGesrY4yBwy BUPHqB+8CO1hclZ/ctwheBkmesE2uu5lzprSafBVJrvjoP4lSRHZ3ko486AoJsnZq2WC Zj+3mFVN7qeQoWmgPzQqIvBINbZ9L88LzetFKqvYrBq49F/C7GnoPvNk7QkVyZ9objai NjUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=sundB5FdbKTbkODKAsGaNX6HYDawENmlhV1n2Lhav9Y=; b=CuzudNeqgzAVs3Zs9GUYmXDILzQNi+ohygmVV9kfVM4WvCXC+Xn0hnCjcr51HeQ4JC puoh+mn9GHEmlk4UluldzIF/CuBdHAeQTsfa81n81kdNzK6xsQjYQZpybjkZenHMK43n ndkBiQikKQkFAHW+Gmh6nnjVXbe90R34ifA8UQGDh6+fUoyFidyGfM6q1IocBB8BlU19 4IjmBK5jfDIgJ5sM3lbIeawCYONY5HNlK8JXHhftVdDLKWevuRcZiqDAC48UTu6EmIeP qOD4rxTb6c0K+c75w4PrBRuxBXx181DwsgQ0kB14hSy+d9JY0mR0JEPg7lePXnuyyoQ5 pr2w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e11si2366455ejh.44.2020.06.01.05.43.05; Mon, 01 Jun 2020 05:43:28 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726094AbgFAMjZ (ORCPT + 99 others); Mon, 1 Jun 2020 08:39:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5321 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725838AbgFAMjY (ORCPT ); Mon, 1 Jun 2020 08:39:24 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7252BF6B52CED81A3185; Mon, 1 Jun 2020 20:39:22 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Mon, 1 Jun 2020 20:39:14 +0800 From: yu kuai To: , , , CC: , , , Subject: [PATCH] block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed Date: Mon, 1 Jun 2020 20:38:56 +0800 Message-ID: <20200601123856.3895734-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug") add a kree() for 'buf' if bio_integrity_add_page() return '0'. However, the object will be freed in bio_integrity_free() since 'bio->bi_opf' and 'bio->bi_integrity' was set previousy in bio_integrity_alloc(). Fixes: commit e7bf90e5afe3 ("block/bio-integrity: fix a memory leak bug") Signed-off-by: yu kuai --- block/bio-integrity.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index bf62c25cde8f..ae07dd78e951 100644 --- a/block/bio-integrity.c +++ b/block/bio-integrity.c @@ -278,7 +278,6 @@ bool bio_integrity_prep(struct bio *bio) if (ret == 0) { printk(KERN_ERR "could not attach integrity payload\n"); - kfree(buf); status = BLK_STS_RESOURCE; goto err_end_io; } -- 2.25.4