Message ID | 20221223072900.802728-1-linmq006@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp187593wrn; Thu, 22 Dec 2022 23:33:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXv+qkCAqdbTz1oFAJlkN5yCXIEHyNU+TTK1LqelWA2TsQexMIv2cVoqmTJutJvGduz57gC2 X-Received: by 2002:a62:36c6:0:b0:576:5a71:454a with SMTP id d189-20020a6236c6000000b005765a71454amr9445615pfa.2.1671780822731; Thu, 22 Dec 2022 23:33:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671780822; cv=none; d=google.com; s=arc-20160816; b=hP8YUwWFEZH3dCRyt7PJqEJPPo8muqjtXHVpAK2db/Fh65ENEgGw8YtTs2i9YDMQ3u uTzpHUVKQDw1ZckhtJXdyS+5F0XpwcvMhDWZaKbFnuUHb4sEYcIMdujY9A07RUEcwu1o D+uC4u8PXyVi90xENLLYhEl6c8AZpaj+1/eirleLUKt0E2gIpR0uSZI+Zv3Q9sXg8N+W O3uHIn77G214P+3zT9b3yBGuBKGMpRFIItyTWYcwg9/vxFbKspCgvk1cR6N4RyRqTbX5 wHBXSiIvOoxcadQG1wPkKXgltAq+bygy5Z8/FmAN4dnOGNf56s+4lqOUxyc4jH8YK08S BDzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yw9A9yDRou+SgBuMxTAj1XCzlTZaZEsmvQlTnHCOqi8=; b=pAA2ZK4JkjVyzfn68E22J4zctIVPdoT2eWdukWAW6Vqe1M/BmjICvNj6GH58y7+K9+ T4tBxuXb3MvLBZS6bwxCJ20cXme8sa5wlBAUYkmzTGMZ1jsGvb4/7JXi0FppwxJp6z9o 62/O9i2ABHfUXKg7U2UZjRm9cDumojy+WrJiFbdRQntbKnocxcemzGvXZLnffrOPjTfc 82RGTm/8la0YJL/5CDG/K6dHjcpptng0ziCBegMcMh7l0ry+ongZ9yCPpo+SGnNQc7kZ DaqtByjuyxZJb1FmwU66Mlb7bHR2YX/e9NrlSj5flvDoR3DgLyTCulOvG3YHMtqWOHvJ nMpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Za4UBmWP; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a6545c4000000b004786e4563c3si2897056pgr.751.2022.12.22.23.33.30; Thu, 22 Dec 2022 23:33:42 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=Za4UBmWP; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbiLWH3O (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Fri, 23 Dec 2022 02:29:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbiLWH3M (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 23 Dec 2022 02:29:12 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7629DDF24; Thu, 22 Dec 2022 23:29:09 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so8089783pjp.1; Thu, 22 Dec 2022 23:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yw9A9yDRou+SgBuMxTAj1XCzlTZaZEsmvQlTnHCOqi8=; b=Za4UBmWPUBlUu8mceW2dmcOspKc5HL3FoyHS/DABwwdSM0V3Ome7WIEms7WjGXdT7f +g/+1g7iUj0NkGqmDG/yq1KOZ+lo2VthXmLaZUbtn0egbjBpHyH+yTuxz/9p4B0azEjr s6PwfXfS482oGDuVTrmAgrzGX/52vwGzIjW5/2G9GKxo6Qfii1bZSMyEweNMwcQJuB9q 3V/v8Lb+yQrKyf5wgsVMFm6/CHeyKzUyK4ItUN6n3eOTMZKZyeMlCei6/8UNLkcprfd9 tS/Tip/k+gs43hvU7QCH4oUIETmpNG1k6lz9vOBFqiH/ejJkN7zqPqdhGE4oU3q0TlzF KHNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yw9A9yDRou+SgBuMxTAj1XCzlTZaZEsmvQlTnHCOqi8=; b=6CfhcO4Eovj1HR8vOF74BIXL9ba8D4cZPWtCfyMIRR/uwOjh7QdXVAmO2a2hA1FBXJ ThPWdkVYkARQEqwvgV0W5kZeqfYrJt92KjGIEfc3y4bY2OngXJVPaiB2ECOwHSOK67H9 JhKKRFUhdhVL9QOTPDxQqC3j+8Z5uuHbQXQEqKAkBMFgB8aCFfzgWCK1sPIDCTw7G3WO sZlQ687/2TwmxbOMOPp6H+h2TjsBuDypMO1G9apXAedH2p0A4dTnPRlGCjcteBu06E+T zUCKdh17BIDVHxh17lk3AMeY1c1kUQvJMksvFgxv7GxOAcCRd7DPGOqCLF8+/tzsaETz HnBw== X-Gm-Message-State: AFqh2kr0jwvcOwIiC1DUHiVQWh88jSlo3s1DbMCjfE8T83pzWFjh2bsp 7SF3W2vn0zbW3VvTV3Kp/NI= X-Received: by 2002:a17:903:40ca:b0:192:4a7b:ee27 with SMTP id t10-20020a17090340ca00b001924a7bee27mr9390055pld.53.1671780548806; Thu, 22 Dec 2022 23:29:08 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id m12-20020a170902d18c00b00186bc66d2cbsm1722921plb.73.2022.12.22.23.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 23:29:08 -0800 (PST) From: Miaoqian Lin <linmq006@gmail.com> To: Haoyue Xu <xuhaoyue1@hisilicon.com>, Wenpeng Liang <liangwenpeng@huawei.com>, Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>, Yixing Liu <liuyixing1@huawei.com>, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH v2] RDMA/hns: Fix refcount leak in hns_roce_mmap Date: Fri, 23 Dec 2022 11:29:00 +0400 Message-Id: <20221223072900.802728-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752989248000706889?= X-GMAIL-MSGID: =?utf-8?q?1752989248000706889?= |
Series |
[v2] RDMA/hns: Fix refcount leak in hns_roce_mmap
|
|
Commit Message
Miaoqian Lin
Dec. 23, 2022, 7:29 a.m. UTC
rdma_user_mmap_entry_get_pgoff() takes the reference.
Add missing rdma_user_mmap_entry_put() to release the reference.
Fixes: 0045e0d3f42e ("RDMA/hns: Support direct wqe of userspace")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
change in v2:
- use goto label to manage the release.
---
drivers/infiniband/hw/hns/hns_roce_main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On Fri, 23 Dec 2022 11:29:00 +0400, Miaoqian Lin wrote: > rdma_user_mmap_entry_get_pgoff() takes the reference. > Add missing rdma_user_mmap_entry_put() to release the reference. > > Applied, thanks! [1/1] RDMA/hns: Fix refcount leak in hns_roce_mmap https://git.kernel.org/rdma/rdma/c/cf6a05c8494a8a Best regards,
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 8ba68ac12388..946ba1109e87 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -443,14 +443,15 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma) prot = pgprot_device(vma->vm_page_prot); break; default: - return -EINVAL; + ret = -EINVAL; + goto out; } ret = rdma_user_mmap_io(uctx, vma, pfn, rdma_entry->npages * PAGE_SIZE, prot, rdma_entry); +out: rdma_user_mmap_entry_put(rdma_entry); - return ret; }