Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5136174rwr; Sun, 23 Apr 2023 22:23:08 -0700 (PDT) X-Google-Smtp-Source: AKy350ZQ2xKMoWm03ia9GfM7j5xtSXse03uIFIeHwJ67rpZ/iozqqv+AMkvo4pVjSwrl4W60ybhu X-Received: by 2002:a05:6a20:a59b:b0:ef:cd49:e122 with SMTP id bc27-20020a056a20a59b00b000efcd49e122mr14500171pzb.35.1682313788001; Sun, 23 Apr 2023 22:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682313787; cv=none; d=google.com; s=arc-20160816; b=KcCzxUvOV59Se3NJ4tTYQNwF99EOhmvRr6of2K1O+shPqpVCyB8/BN07dInSkjvUtz VRFpq2dIetd5KNTuHynhTjVwD64T937T5jLVwFG0W/smZXAfSrg+rNiaAXzMOBOVsi93 zZt6BH9YeoZ6Z5BGofnA/xYctYpvNJOmfiBths/pqYa1sSUcwDfGNSQYYAcMOHumETZ8 efAn1IN+sqAvSpixxr4LjBYjMGiD506vwntcvYPubqJ1VEZHDfK46asj/yfiaGebnOZn W3U9EyA7VnkmCeqZGM6QNmKjgQ8bEKd5aMRIotIyH0pInzpjmI4P0qIkmO0816KHWFvO q6zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sMme/ObWE1XqtqiMZ6pEeHuCDa0x+FmPGqWx4VJyi4Y=; b=DRxfHA8CTA71jPt5DAaJ8R5OOGVOcCt7hwjdPiP8pGMerpHBQzAybw+M+6mG1Puf75 CtBxO2gpv7ZpMj8yJX9tN+H69WSWwestYR97GgGhCjdrfr2HbS7QKXwn3BFkNgnPGE+U 4s39/GBQCtr2DKCXepjwb/EjCOQCBqOtxo0kuRuZ4naBbiX6IxJTTVRiPDt2iisrkYGd pPMPnAkhrmJFP8OgzaFj0Rvi6KDAlpAKrZDuoPYOiIVuIEUaJ4ujLDRhNVBv77sWP+iF rbSDhXqpGEy3waIx2t5IE6D+oqxiky7SeyeVcAwx/wyYFU3xwUQtAj9hrXuIbkpLezaZ 0gIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=JspeccNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id la5-20020a170902fa0500b001a93e74c8b8si8072514plb.481.2023.04.23.22.22.55; Sun, 23 Apr 2023 22:23:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=JspeccNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229478AbjDXFSr (ORCPT + 99 others); Mon, 24 Apr 2023 01:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjDXFSm (ORCPT ); Mon, 24 Apr 2023 01:18:42 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F5D926A3 for ; Sun, 23 Apr 2023 22:18:40 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-506bdf29712so29686917a12.0 for ; Sun, 23 Apr 2023 22:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1682313519; x=1684905519; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sMme/ObWE1XqtqiMZ6pEeHuCDa0x+FmPGqWx4VJyi4Y=; b=JspeccNTbD/aZwbTWRtpKIpWvGw3H/ycf7IxvjiRK/XeTzPfJoUWsl9ROqnQfgnkzw pSRSbm/CkVzDKLzYwjlzS0HIkTCxyoP2uEr3P7FHbhEab9QvtKMf1XaXQH5yWmNKs8dX 0Vl4tb9w36GjJORSXry5+u08TGxCW/VpuYJzEMizyk3JaMuj9X/8n4jX5vF+cBuDdzdS WKAAW8o/G1WlUueOJzHKOJqY8H61nE4T8FJMtdejTeHduMl7DdrcHwLnUSpNrTyPEEqN KDoLQmFkKC3kKHISc5WRN62BMCHfcX6vLuXzLkIok1wpAYlvI62bUqz+oqA2LX++PDrI fczQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682313519; x=1684905519; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sMme/ObWE1XqtqiMZ6pEeHuCDa0x+FmPGqWx4VJyi4Y=; b=JVltNBN+dSQq65sNupLxY3/WDIdt7AA0B4SX08C8IE1ypx1q8Xvev0E3VzPFM638+J kgt5MDE8lHwpvuMqI3L0uCq5WwrNVVPIc97B5QVjtbPchc2X7jXjvXgwLUho4/Sx0HBE tO/EXw+iN29S20CWaA5z0EqcbhqChXoznMUEdWrsr1JBHwxLev7C09YiRwDjDV/+0wBh TIX7h8oSUQ6l4QfFFcnRkq1T7/NqwVqUQpMpXoQ+oJd6BAIaUcCjjPDRk3dyetO7aazp ogEU1LamLYMD1uP6revQuQdsYfxQMTheAYnC2/Ji449ecYtGFbMFWRf8u8eRdMn2xGrS JYdQ== X-Gm-Message-State: AAQBX9eyysmeJrDtG/WwG0i+j2SZ6jNsQ/lpAj2kWecb5dHLjv9PtTOa KAkmZJ8pAPP/ATlqqUWI5JD0MZBZB67LHK+eV+k7lg== X-Received: by 2002:a05:6402:14d8:b0:504:88fb:8841 with SMTP id f24-20020a05640214d800b0050488fb8841mr10312980edx.21.1682313518856; Sun, 23 Apr 2023 22:18:38 -0700 (PDT) MIME-Version: 1.0 References: <1682213212-2-1-git-send-email-lizhijian@fujitsu.com> <1682213212-2-3-git-send-email-lizhijian@fujitsu.com> In-Reply-To: <1682213212-2-3-git-send-email-lizhijian@fujitsu.com> From: Jinpu Wang Date: Mon, 24 Apr 2023 07:18:27 +0200 Message-ID: Subject: Re: [PATCH for-next v2 2/3] RDMA/rtrs: Fix the last iu->buf leak in err path To: Li Zhijian Cc: haris.iqbal@ionos.com, jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org, guoqing.jiang@linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 23, 2023 at 3:27=E2=80=AFAM Li Zhijian = wrote: > > The last iu->buf will leak if ib_dma_mapping_error() fails. > > Signed-off-by: Li Zhijian Yes, as guoqing suggested, please add the Fixes tag. Acked-by: Jack Wang > --- > V2: new patch to address memory leaking > --- > drivers/infiniband/ulp/rtrs/rtrs.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/= rtrs/rtrs.c > index 4bf9d868cc52..3696f367ff51 100644 > --- a/drivers/infiniband/ulp/rtrs/rtrs.c > +++ b/drivers/infiniband/ulp/rtrs/rtrs.c > @@ -37,8 +37,10 @@ struct rtrs_iu *rtrs_iu_alloc(u32 iu_num, size_t size,= gfp_t gfp_mask, > goto err; > > iu->dma_addr =3D ib_dma_map_single(dma_dev, iu->buf, size= , dir); > - if (ib_dma_mapping_error(dma_dev, iu->dma_addr)) > + if (ib_dma_mapping_error(dma_dev, iu->dma_addr)) { > + kfree(iu->buf); > goto err; > + } > > iu->cqe.done =3D done; > iu->size =3D size; > -- > 2.29.2 >