From patchwork Tue Dec 20 11:30:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 35042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2913555wrn; Tue, 20 Dec 2022 03:36:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf566az9WCSBBwF+yavOcXP1HvN8na3Y64kgm1XDRnwKdZY4Ksazp4Z6DyF7UqdTqTttkwHK X-Received: by 2002:a17:906:46c3:b0:78d:f455:30f8 with SMTP id k3-20020a17090646c300b0078df45530f8mr38145514ejs.32.1671536187729; Tue, 20 Dec 2022 03:36:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671536187; cv=none; d=google.com; s=arc-20160816; b=dVs9QbzP2X82pJ8NtTIpQ2cDhgfKXXA/i/pkkcX/g7RzJzJzIoPsyO3Ifw3ypDRR29 kBeoPbhl69aww836XgsrpjmG7Mw0ZeJEyVVOuqcE+PYHpzYj3G/sOrdZyFFtRslyvE0W 2m4xq3iWUxWLNC53xXqeck7p6LXGbVZ46Rlhqp/ljcrfODY0+mMbUfjLehoeGHaCy/LG fQ9VImOW1igadc/EFmmPnIX9NCLVRnvkSBvHTJ9Pk4lq9DIxMhw3cVc4c3JwefJnnXMA 4roq6W3dH/BK9YWgzSaiHi2k5iPJRWPtWi3uEpiPf0r5xwWPfSDDfXxidjZ6A6COPB8k 16ng== 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=9ue5drNbkBvKVzpPDG78ZMfbrHrE9A5Ia9TcUjCSfCo=; b=TXvtOAcmugKH2Y3x3AnkCUWDdLj6QYy0ViVHe+tPf7F720dvxgdnd083CC7/wjln1H JJD+VGX/kU4ZsDQnvGZPZ8zYBhk9ICsb/7bRQGoesv6FCdo1wIJ0nsPI7YWICp+qLvq/ r6aqnZXP3pJkQjqdRkhMBXuI2vLKXqDsrIKly3Uw+eZfaVm+UijS2D+nY0CUazA9YWWc D5kmsyeAYvJlsheL3gZE7d56Ehh7nnLpoU1JXH/1deZpOunOtd4j/MN8ga8fKZ0qH8Ma vz+B6Sn+/avsZtYQyI6sHTjGwoD6geo1+uUTlQ/5PprklhZNZDz92CVDqyjFqLCXAEoN Q5ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m5ESKvT3; 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 f13-20020a056402354d00b0046109fd5943si703428edd.544.2022.12.20.03.36.04; Tue, 20 Dec 2022 03:36:27 -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=m5ESKvT3; 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 S231434AbiLTLbl (ORCPT + 99 others); Tue, 20 Dec 2022 06:31:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233497AbiLTLbK (ORCPT ); Tue, 20 Dec 2022 06:31:10 -0500 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 CA94219295; Tue, 20 Dec 2022 03:31:02 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id k88-20020a17090a4ce100b00219d0b857bcso11838178pjh.1; Tue, 20 Dec 2022 03:31:02 -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=9ue5drNbkBvKVzpPDG78ZMfbrHrE9A5Ia9TcUjCSfCo=; b=m5ESKvT3Lf0CT9weWsfxqVpy1q9ZvbcLvSundZywEFYQEH5yXW5k+2ZrrKlnPsgxK8 +2SbLpoj+YfpyhPNVvVqFCsKkmctQLGIu6NzUdOYm7kbT9awps9bcn5VgcpjBXEyxvTc ovkKDmcHJ0Ifco/pZI+bxsQO8XfpkMg7QreIoU+tik2Lx7DFX+L6aTOr6qLj5XaysIo9 gqvjojE7osPcGGc84kXE7KvYSM2lmv5GnyuvxqWM6Jxno//iKbgKL4wWE/AWy5K2NuVk 6A/TqhOWZ5V1ej2FpGgXS116W/XsZ4m8saXKe205ZRWd6Ao1VamJzCdqnGQ65Awt1Iaw rThQ== 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=9ue5drNbkBvKVzpPDG78ZMfbrHrE9A5Ia9TcUjCSfCo=; b=hAqB66ZuxCQUVkuVE+H7NfnvjvKkY9/7NrC1aZVbR5Go3g/lBdtoFEMpWePRRkxNH1 yEIdPrubLFiRLlfXYDXOc6G27DIjMT0mJkzrqLLTMLQpT17VkE8DzceKzdRH9Y+RGk4U Q3g95wra101D5N1rRyKF5eOxkDJJOuqN+l5YrbUUb6NziDYfsliXPIZy85XK3X7WdTwN TPZqUby9tiz4HBCjXdf3QWXz5oy2CQMr7yrQg8rz3JmDI5J+qHaWPgI+2vp2ylrQxenI oMpk8FiPixrbjRSrfz4nuu78zbGnPFqq1hd5UjLl/F/6NzdKGy/oFt4DHLWhCoF3P0JN kuug== X-Gm-Message-State: ANoB5plr/xxtzlQzorEhQPKOg8l9hfmtkVPW2ktdOk6e7YlP0xX85DWa CjeiSIDmsmlqrl11hsl8++0= X-Received: by 2002:a17:90a:f191:b0:21a:1b9b:139e with SMTP id bv17-20020a17090af19100b0021a1b9b139emr47606235pjb.8.1671535862337; Tue, 20 Dec 2022 03:31:02 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id om7-20020a17090b3a8700b001fde655225fsm1610785pjb.2.2022.12.20.03.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Dec 2022 03:31:01 -0800 (PST) From: Miaoqian Lin To: Haoyue Xu , Wenpeng Liang , Jason Gunthorpe , Leon Romanovsky , Yixing Liu , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH] RDMA/hns: Fix refcount leak in hns_roce_mmap Date: Tue, 20 Dec 2022 15:30:47 +0400 Message-Id: <20221220113047.1463078-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752732729579389904?= X-GMAIL-MSGID: =?utf-8?q?1752732729579389904?= rdma_user_mmap_entry_get_pgoff() takes 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 --- drivers/infiniband/hw/hns/hns_roce_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 8ba68ac12388..fbff8df9236d 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -443,6 +443,7 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma) prot = pgprot_device(vma->vm_page_prot); break; default: + rdma_user_mmap_entry_put(rdma_entry); return -EINVAL; }