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: <1682213212-2-3-git-send-email-lizhijian@fujitsu.com>
Date:   Sun, 23 Apr 2023 01:26:51 +0000
From:   Li Zhijian <lizhijian@...itsu.com>
To:     <haris.iqbal@...os.com>, <jinpu.wang@...os.com>, <jgg@...pe.ca>,
        <leon@...nel.org>, <linux-rdma@...r.kernel.org>
CC:     <guoqing.jiang@...ux.dev>, <linux-kernel@...r.kernel.org>,
        Li Zhijian <lizhijian@...itsu.com>
Subject: [PATCH for-next v2 2/3] RDMA/rtrs: Fix the last iu->buf leak in err path

The last iu->buf will leak if ib_dma_mapping_error() fails.

Signed-off-by: Li Zhijian <lizhijian@...itsu.com>
---
V2: new patch to address memory leaking
---
 drivers/infiniband/ulp/rtrs/rtrs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c
index 4bf9d868cc52..3696f367ff51 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs.c
@@ -37,8 +37,10 @@ struct rtrs_iu *rtrs_iu_alloc(u32 iu_num, size_t size, gfp_t gfp_mask,
 			goto err;
 
 		iu->dma_addr = ib_dma_map_single(dma_dev, iu->buf, size, dir);
-		if (ib_dma_mapping_error(dma_dev, iu->dma_addr))
+		if (ib_dma_mapping_error(dma_dev, iu->dma_addr)) {
+			kfree(iu->buf);
 			goto err;
+		}
 
 		iu->cqe.done  = done;
 		iu->size      = size;
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ