From patchwork Thu Mar 23 05:21:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Vajravel X-Patchwork-Id: 13184992 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7217CC6FD1D for ; Thu, 23 Mar 2023 05:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229597AbjCWFVz (ORCPT ); Thu, 23 Mar 2023 01:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjCWFVx (ORCPT ); Thu, 23 Mar 2023 01:21:53 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A816171E for ; Wed, 22 Mar 2023 22:21:53 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id fd25so12466550pfb.1 for ; Wed, 22 Mar 2023 22:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1679548912; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=+4qXBHY+Th+1V1xVb1pPrpRqFB3md4Kvi/0wlojxfqc=; b=KddeE00Mz68Jv7wUP2RKX0dCMzl0nuyO0mbojqOO4T35dkCIeMY7SFnsDTuBHKC0uJ 1THAGfUg+LHVFsCUq7v40L5jnrJBymqYsOisgBVbD3OKPolTvW8/jBhO9c54RZ8kYJNJ ytA6SpdBxEG116a86gIj41Ka52eb5VvhZqk3A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679548912; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+4qXBHY+Th+1V1xVb1pPrpRqFB3md4Kvi/0wlojxfqc=; b=FJEjM3HID8fI7CGZGtewTVLpHuUp3+qgLkjXW0PEVX2Fmcjj1XUomxv3ffTIaUk3uc cufyEdZphVsEjQ2Og+/Y3zBR1P2pQLhcBWkhVXnRVdaQoujtuOvorxeL9Uf0bQYOM9iy ATLZR6At+srvxT22ZeDsSXXmSEEq+OAjYprAdLdbwcYLRmey9ouWSQNHELNMZl5hrhec FJAnp+o+u23SMGYRMSktHX5PQO8SoMnJ4QunVmoZWVcTMl0LEzZjQgHdfOB1HzoBgYiT XQbEcZ0nc73d0VrtP00b9cEN/ccjOG3T0Mm0CtQkAcIYI61vxQGX5kfNreSDOMJtHd7o WMKA== X-Gm-Message-State: AO0yUKUc4uHIbXQEY9VHXQjCAYOFsjI8rYnbrUt9Ipeq2oX3B3Lo/HBP 9p4FPAN9GrHvHtKVSxr+/Ky4eIF8mjMV0Is7QM6ztFKRBfKks0u8OtgXdJsIlAxSXpThUvipHuq UN1b39MxHoDK6iq65S7uSqj1hcg== X-Google-Smtp-Source: AK7set+S0pG+2bGrXVDGUElDEltSStp10G85fmB+8vtdb5/HH/S5YIBO8P3aZbGqw6us3wfW813s7w== X-Received: by 2002:a62:38cf:0:b0:625:ce06:e58 with SMTP id f198-20020a6238cf000000b00625ce060e58mr4802744pfa.17.1679548912371; Wed, 22 Mar 2023 22:21:52 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id q25-20020a62ae19000000b005d92c9afbd4sm11001758pff.33.2023.03.22.22.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 22:21:51 -0700 (PDT) From: Saravanan Vajravel To: jgg@ziepe.ca, leon@kernel.org, selvin.xavier@broadcom.com Cc: linux-rdma@vger.kernel.org, Saravanan Vajravel Subject: [PATCH for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails Date: Wed, 22 Mar 2023 22:21:40 -0700 Message-Id: <20230323052140.143843-1-saravanan.vajravel@broadcom.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org If AH create request fails, release sgid_attr to avoid GID entry referrence leak reported while releasing GID table Fixes: 1a1f460ff151 ("RDMA: Hold the sgid_attr inside the struct ib_ah/qp") Reviewed-by: Selvin Xavier Signed-off-by: Saravanan Vajravel --- drivers/infiniband/core/verbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 11b1c1603aeb..b99b3cc283b6 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -532,6 +532,8 @@ static struct ib_ah *_rdma_create_ah(struct ib_pd *pd, else ret = device->ops.create_ah(ah, &init_attr, NULL); if (ret) { + if (ah->sgid_attr) + rdma_put_gid_attr(ah->sgid_attr); kfree(ah); return ERR_PTR(ret); }