Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765830AbcLVGr5 (ORCPT ); Thu, 22 Dec 2016 01:47:57 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:28373 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbcLVGr4 (ORCPT ); Thu, 22 Dec 2016 01:47:56 -0500 From: Kenneth Lee To: , , CC: , , , , , , , , , , , Subject: [PATCH] ib umem: bug: put pid back before return from error path Date: Thu, 22 Dec 2016 15:11:32 +0800 Message-ID: <1482390692-147946-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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 964 Lines: 30 I catched this bug when reading the code. I'm sorry I have no hardware to test it. But it is abviously a bug. Signed-off-by: Kenneth Lee --- 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