From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753825AbcL3Kwj (ORCPT ); Fri, 30 Dec 2016 05:52:39 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:37919 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752595AbcL3Kwh (ORCPT ); Fri, 30 Dec 2016 05:52:37 -0500 From: Kenneth Lee To: , , CC: , , , , , , , , , , , Subject: [PATCH v3] IB/umem: Release pid in error and ODP flow Date: Fri, 30 Dec 2016 18:18:29 +0800 Message-ID: <1483093109-188428-1-git-send-email-liguozhu@hisilicon.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.58663B22.029A,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 745b2803ca153fbeaffed8e4283da8b0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are two bugfixes in this patch: Fixes: 87773dd56d54 ("IB: ib_umem_release() should decrement mm->pinned_vm from ib_umem_get") This patch introduce the get_task_pid but not put it back on all error path Fixes: 8ada2c1c0c1d ("IB/core: Add support for on demand paging regions") This patch introduce a ODP flow without release pid before enter it Signed-off-by: Kenneth Lee Reviewed-by: Haggai Eran --- Change from v1 to v2: Correcting the patch title and description Change from v2 to v3: Update the title and add "Fixes" fields in the description drivers/infiniband/core/umem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 1e62a5f..4609b92 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -134,6 +134,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_MW_BIND)); if (access & IB_ACCESS_ON_DEMAND) { + put_pid(umem->pid); ret = ib_umem_odp_get(context, umem); if (ret) { kfree(umem); @@ -149,6 +150,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, page_list = (struct page **) __get_free_page(GFP_KERNEL); if (!page_list) { + put_pid(umem->pid); kfree(umem); return ERR_PTR(-ENOMEM); } -- 1.9.1