lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <OF71AC5E77.84B4E5A4-ON0025854B.003341FF-0025854B.00334209@notes.na.collabserv.com>
Date:   Wed, 15 Apr 2020 09:19:52 +0000
From:   "Bernard Metzler" <BMT@...ich.ibm.com>
To:     "Xiyu Yang" <xiyuyang19@...an.edu.cn>
Cc:     "Doug Ledford" <dledford@...hat.com>,
        "Jason Gunthorpe" <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org, yuanxzhang@...an.edu.cn,
        kjlu@....edu, "Xin Tan" <tanxin.ctf@...il.com>
Subject: Re:  [PATCH] RDMA/siw: Fix potential siw_mem refcnt leak in nr_add_node

-----linux-rdma-owner@...r.kernel.org wrote: -----

>To: "Bernard Metzler" <bmt@...ich.ibm.com>, "Doug Ledford"
><dledford@...hat.com>, "Jason Gunthorpe" <jgg@...pe.ca>,
>linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
>From: "Xiyu Yang" 
>Sent by: linux-rdma-owner@...r.kernel.org
>Date: 04/15/2020 10:46AM
>Cc: yuanxzhang@...an.edu.cn, kjlu@....edu, "Xiyu Yang"
><xiyuyang19@...an.edu.cn>, "Xin Tan" <tanxin.ctf@...il.com>
>Subject: [EXTERNAL] [PATCH] RDMA/siw: Fix potential siw_mem refcnt
>leak in nr_add_node
>
>siw_fastreg_mr() invokes siw_mem_id2obj(), which returns a local
>reference of the siw_mem object to "mem" with increased refcnt.
>When siw_fastreg_mr() returns, "mem" becomes invalid, so the refcount
>should be decreased to keep refcount balanced.
>
>The issue happens in one error path of siw_fastreg_mr(). When
>"base_mr"
>equals to NULL but "mem" is not NULL, the function forgets to
>decrease
>the refcnt increased by siw_mem_id2obj() and causes a refcnt leak.
>
>Fix this issue by calling siw_mem_put() on this error path when mem
>is
>not NULL.
>
>Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
>Signed-off-by: Xin Tan <tanxin.ctf@...il.com>
>---
> drivers/infiniband/sw/siw/siw_qp_tx.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c
>b/drivers/infiniband/sw/siw/siw_qp_tx.c
>index ae92c8080967..86044a44b83b 100644
>--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
>+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
>@@ -926,6 +926,8 @@ static int siw_fastreg_mr(struct ib_pd *pd,
>struct siw_sqe *sqe)
> 	siw_dbg_pd(pd, "STag 0x%08x\n", sqe->rkey);
> 
> 	if (unlikely(!mem || !base_mr)) {
>+		if (mem)
>+			siw_mem_put(mem);
> 		pr_warn("siw: fastreg: STag 0x%08x unknown\n", sqe->rkey);
> 		return -EINVAL;
> 	}
>-- 

I agree - thanks for the fix!


Reviewed-by: Bernard Metzler <bmt@...ich.ibm.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ