Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3223084imw; Mon, 18 Jul 2022 04:30:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vOT6PxB4ebsQ45hMRcg6AM2EPYSwp+zXakMEMCjH6o0MRmo9+m7lOSbJL/yqLYdLURS4SX X-Received: by 2002:a17:906:93e8:b0:72b:6923:a0b9 with SMTP id yl8-20020a17090693e800b0072b6923a0b9mr24164671ejb.244.1658143807465; Mon, 18 Jul 2022 04:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658143807; cv=none; d=google.com; s=arc-20160816; b=PB2R/BjChpC8r+rF/nT+sY0R98Vqa2Rpv1+N+i+yvNgxZIZl5HmG8ZTemIzV9r+xzV vIByHn+AitvT+YmcDsIRA2w/bDSQhfKS4uHIWtvVZ/4s+8OOXhV05bboqKLvGMmpmpwK b+9SsrdcN/KiHwrnMavr8hnsreAEpJsagar1AG12KxbB+f1FMKiKO+k2mKxLSHZ8Dukk 4WS6EexmHYsbOBG5cJSxw+MX/iV/IVaO9Q41tkhkc7fY7jgFoZ7jApoyeYpFQuYyPA22 VX5dNptQs/9+Ia6SSr4kVfVwOmRv0281wjWqDEaSV3M3VNOIhIUHp0iGL0g2lB5I/u5P s0eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ZhrSL7W/QyVt1VF4YZb3qVpgxrxWl9khZ3tkxSYB9SU=; b=Z8lpQhpP4uf9tK5sum86SVZ+Xad+4xxpTtUmxNpt2omkTm4DQg7PSx/qot0lJVpaRj +Ofn4IqrC3O7NvC86OENI5fXqxPa1Z9n4mGT8b3Mu5+UfbtKJsmyWH53luTTDuiijKXz eLkd2+bYrYPBrjynmYbFClXXvXMRJ9GezUKJIMOo2Aj1uGOHMmWG2OnJkQI8Rs7TG2kB 1pOy8to8I4xyu4zN+2u4x0K6dfWudB3trwUtyO+J4CNLihj01b5jaEI23+38SIyx25De 3uIycPiF06PqCBIo0kd/M+vii5xTbX/z4TZrqjePOfHZoC0PjEPRE4fwUwX1S4ZQgNIy NBOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jr8InTyk; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s20-20020aa7d794000000b0043ad5430053si13528008edq.448.2022.07.18.04.29.38; Mon, 18 Jul 2022 04:30: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=@kernel.org header.s=k20201202 header.b=Jr8InTyk; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234488AbiGRLD7 (ORCPT + 99 others); Mon, 18 Jul 2022 07:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234482AbiGRLD5 (ORCPT ); Mon, 18 Jul 2022 07:03:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 476D06570; Mon, 18 Jul 2022 04:03:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 05141B8111D; Mon, 18 Jul 2022 11:03:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3117EC341C0; Mon, 18 Jul 2022 11:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658142234; bh=EFa5qbZPRcqpYw9J5oxsXohxWl/hvq/z2A343vHh2Xo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Jr8InTyk6FrYLBSagUXNLM5mimKkojJqZ/0IWY9ZiN/gv8fWvEy+f54RhWQ0k5OXz SVv8qFRN0BHFJH0eBgZUn7aH3XRLgCxui/mtlQEPJgQw8tQBsfP3bbgUHRFvLNcj6V vXw2iCcxFqmY6Yj/qNix8QNVny9EdpkI8gRyNlDzVZyBI/4aQo3FOlR8ELCb+QEejm PqdV6kj2Nf/dJokOMtKCpi0SGPla70olZIiMcOa7n/XZdwY7xUqxhu0S3OTPFFiK3D /aKkz3kW5HPAf3ydUvj247I0JhIcJgAMc712BGz6umZG/wnUmL8mQ0XAGdJARZXsvN 8ezIWAbPlWLkg== Date: Mon, 18 Jul 2022 14:03:45 +0300 From: Leon Romanovsky To: Jianglei Nie Cc: mkalderon@marvell.com, aelior@marvell.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr() Message-ID: References: <20220714061505.2342759-1-niejianglei2021@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220714061505.2342759-1-niejianglei2021@163.com> X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Thu, Jul 14, 2022 at 02:15:05PM +0800, Jianglei Nie wrote: > __qedr_alloc_mr() allocates a memory chunk for "mr->info.pbl_table" with > init_mr_info(). When rdma_alloc_tid() and rdma_register_tid() fail, "mr" > is released while "mr->info.pbl_table" is not released, which will lead > to a memory leak. > > We should release the "mr->info.pbl_table" with qedr_free_pbl() when error > occurs to fix the memory leak. > > Signed-off-by: Jianglei Nie > --- > drivers/infiniband/hw/qedr/verbs.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > Added fixes line. Fixes: e0290cce6ac0 ("qedr: Add support for memory registeration verbs") Thanks, applied.