Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1099531ybg; Tue, 2 Jun 2020 01:04:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1j9o8L8gSm5uJAC7B/tUVoZ3R+yTx+Q6LSn5GM3zL0snjtzOVkZrE3LDLUXgP4jYZEt2Q X-Received: by 2002:a17:906:a889:: with SMTP id ha9mr4584782ejb.429.1591085046560; Tue, 02 Jun 2020 01:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591085046; cv=none; d=google.com; s=arc-20160816; b=N+l0bOmWfGq9n1qeLWDTd3g9o1MJJ1Vo9ToK88pzI2wZv1Shen8rpgNb0IJAX4UoOm soKVG3Ecye+jMT0ucsC4FG5ePv3o8gMVMti4sj8MYQuBfWn9FQnoe3P3iwaHwea9NOzG EL9X2lfC+fAXr0dvSiz2oYB3Vofelvsj0PYE7Qi1aMb1Td3nmcSTYiPkavAH2yUs/CFF RyxksAy/QJGHzMyiabz45WYwGlHNZrVv8j+UXXT4zancbGt4ynR0TJQekFMl1Oe9ZhP+ m9gomESH+WvesVE6bYA4kvG1dD8C6hCbu8CS+j40HuHJr7+r3Lq+9tLDbzxqWp2Z0VG+ MNoQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=hxfcsqFFJfllZ2M4bcJmu85MukQ2QTy19xfU8ihmlac=; b=CL/YbKQFJCl+4bPj6eUDL6o7FmD7K1babKD1VYMAupuaYVorR5MGehXOyeaPxGMFWs iX86HcnDGcejY7l78Z/Fxa+26fFr0sEMB3FGGm3hm2cCKfpJZRKcJn6QXQbBHQwGulu7 9lEEz3+BR5gec2HOz7+puyoG9SHAW/x3J0B3e7i0fHDdESvH2Zb2nq3zwJ+iZAWqWCN2 MA9YE85wHDN8lFt2oIcliaHuUq4tanxcw9y9sk89ei7LTV8FUoiTSFsq8ZjsUEOuFJZ8 bMiibVfKmeqh1FDEbCra7CoaE/6oSvPr1qh6VbMQefp8DJEGWHpGKxGoKECZ1euLaKFj P5lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=yP+4LxNp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n13si1053595ejh.342.2020.06.02.01.03.43; Tue, 02 Jun 2020 01:04:06 -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; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=yP+4LxNp; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726217AbgFBIBe (ORCPT + 99 others); Tue, 2 Jun 2020 04:01:34 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:60000 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgFBIBd (ORCPT ); Tue, 2 Jun 2020 04:01:33 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0527uY1u088522; Tue, 2 Jun 2020 08:01:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=hxfcsqFFJfllZ2M4bcJmu85MukQ2QTy19xfU8ihmlac=; b=yP+4LxNp9BykBqQNCtQkgojOF47zsIzMDQ+taKumcqlXNS21E46lD5cnaMh5J2Og0QCG Aozuu6QuAh8Azen2R2FWmgwtqSG3ZoS49eodK+ErixVOikZgM9J9gcYpaYMG516mkxdT 4fRDsgjElCvL26PVHzOYaYDI/nEuxn+1LgMxXbQoW84S5Ji2kqO9azmGQpoe9yKLrR7k fwhfw3LW+fLpdbTN0PJ3nF50SgGrIXdgEryHYhbXJgquPC9SdAZFGAytpx+c0KUhxQ8m nP+vNedgA40oYrqivZ7z8fdIYEikx9aH6PMjTkO1bT35IEEtE3akcQ/X2yQHTFvHD6BE xA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 31bfem2hdb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 02 Jun 2020 08:01:23 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0527vtAJ126069; Tue, 2 Jun 2020 08:01:23 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 31c25n4ygb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Jun 2020 08:01:23 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 05281MLN028195; Tue, 2 Jun 2020 08:01:22 GMT Received: from [192.168.0.110] (/183.246.144.78) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 02 Jun 2020 01:01:22 -0700 Subject: Re: [PATCH] block/bio-integrity: don't free 'buf' if bio_integrity_add_page() failed To: yu kuai , axboe@kernel.dk, ming.lei@redhat.com, martin.petersen@oracle.com, wenwen@cs.uga.edu Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com References: <20200601123856.3895734-1-yukuai3@huawei.com> From: Bob Liu Message-ID: <28b53354-7012-4559-943e-21526864dd10@oracle.com> Date: Tue, 2 Jun 2020 16:01:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200601123856.3895734-1-yukuai3@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9639 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=2 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006020051 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9639 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=2 mlxlogscore=999 priorityscore=1501 bulkscore=0 phishscore=0 clxscore=1011 impostorscore=0 adultscore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006020051 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/1/20 8:38 PM, yu kuai wrote: > 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; > } > Looks good to me. Reviewed-by: Bob Liu