From patchwork Sat Apr 1 06:34:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saravanan Vajravel X-Patchwork-Id: 13196738 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 0CBD5C76196 for ; Sat, 1 Apr 2023 06:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231213AbjDAGem (ORCPT ); Sat, 1 Apr 2023 02:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjDAGem (ORCPT ); Sat, 1 Apr 2023 02:34:42 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1307E1D85C for ; Fri, 31 Mar 2023 23:34:40 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id l9-20020a17090a3f0900b0023d32684e7fso9940816pjc.1 for ; Fri, 31 Mar 2023 23:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1680330879; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=gm1+fyxqSXiQgof6Mw752G/xnCV7mpvHo6PrdyKmD8I=; b=ATVnDlHqNTseuQhRDRo+FV2LSfxs5JQvrkLYvVDmEQe9gkI6w5agRmIlU2t6jI5hOl KNqAcZYRfNYJRSiNo23JAcBb8RcUzqfMmS/Er7kDKzwjMfmIKV5YaXRa5aRN7NHXBI7r 1/PS/IJ67OSDB6zVKKbKvPe/4ZuWWCqvKBAWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680330879; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gm1+fyxqSXiQgof6Mw752G/xnCV7mpvHo6PrdyKmD8I=; b=Bzgd/G3qk2fuk4tWX/cvvF8qXYNYhFHhf2C0+6m3kt9YzbiVhQIxtWhD8J7vD+Qe/r nIyp2zeZPp+X3YnJ2K8OFQoAb0PHk6QphWge/xzu/wgr0VqgPuqN+O7yQOZ1pR0HB7M0 9zaS8AMXwbqtTXHT6zt0k/BseTDPNSptVPwMXEgxmMVhnoAETJAEEo2HT7ecD45GwHvZ E4KjjCR8WHmNmDhZ3E2jIzUXZz1Rkgpptaj5AHHL6h2hjkvaPtpJzmZGb7UsECSMJQEo lGfOqF6hKkdc8rkmjp/FpckmO5J/mGuFJ7jMGPxoBk/zCanBw517cpwhPcfXS6Z/VvEd kIrg== X-Gm-Message-State: AAQBX9fKmOBsDZ3qzlJ+JdIWmhPgJEaJaWMGinO1q5FmzsxXakI2FhwF MER2rfo3lENufsyzNhepLtdEKztX0ht1qlmA9Vg= X-Google-Smtp-Source: AKy350Y0FoWgvkkCEAoX037Msgh9BlC13kKGNsv9WvTJRNnXcu4OGGcUCJ07Q7y+j1MfXUW1E5oB6Q== X-Received: by 2002:a17:90a:1951:b0:237:373e:9dfa with SMTP id 17-20020a17090a195100b00237373e9dfamr32979308pjh.20.1680330879183; Fri, 31 Mar 2023 23:34:39 -0700 (PDT) Received: from localhost.localdomain ([192.19.252.250]) by smtp.gmail.com with ESMTPSA id t2-20020a17090ae50200b00240404fe949sm5972622pjy.40.2023.03.31.23.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 23:34:38 -0700 (PDT) From: Saravanan Vajravel To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, Saravanan Vajravel , Selvin Xavier Subject: [PATCH v2 for-rc] RDMA/core: Fix GID entry ref leak when create_ah fails Date: Fri, 31 Mar 2023 23:34:24 -0700 Message-Id: <20230401063424.342204-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 --- v1->v2: - Fix email trailer message 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); }