From: Li Zhijian <lizhijian@fujitsu.com>
To: <haris.iqbal@ionos.com>, <jinpu.wang@ionos.com>,
<linux-rdma@vger.kernel.org>
Cc: <jgg@ziepe.ca>, <leon@kernel.org>, <guoqing.jiang@linux.dev>,
<linux-kernel@vger.kernel.org>,
Li Zhijian <lizhijian@fujitsu.com>
Subject: [PATCH for-next v3 2/3] RDMA/rtrs: Fix the last iu->buf leak in err path
Date: Tue, 25 Apr 2023 01:02:42 +0000 [thread overview]
Message-ID: <1682384563-2-3-git-send-email-lizhijian@fujitsu.com> (raw)
In-Reply-To: <1682384563-2-1-git-send-email-lizhijian@fujitsu.com>
The last iu->buf will leak if ib_dma_mapping_error() fails.
Fixes: c0894b3ea69d ("RDMA/rtrs: core: lib functions shared between client and server modules")
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Acked-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
---
V3: add fixes and acked tags
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
next prev parent reply other threads:[~2023-04-25 1:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 1:02 [PATCH for-next v3 0/3] RDMA/rtrs: bugfix and cleanups Li Zhijian
2023-04-25 1:02 ` [PATCH for-next v3 1/3] RDMA/rtrs: remove duplicate cq_num assignment Li Zhijian
2023-04-25 1:02 ` Li Zhijian [this message]
2023-04-25 1:02 ` [PATCH for-next v3 3/3] RDMA/rtrs: Fix rxe_dealloc_pd warning Li Zhijian
2023-06-01 17:33 ` Jason Gunthorpe
2023-06-01 19:17 ` Jinpu Wang
2023-05-09 1:20 ` [PATCH for-next v3 0/3] RDMA/rtrs: bugfix and cleanups Zhijian Li (Fujitsu)
2023-05-09 7:59 ` Leon Romanovsky
2023-06-01 17:22 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1682384563-2-3-git-send-email-lizhijian@fujitsu.com \
--to=lizhijian@fujitsu.com \
--cc=guoqing.jiang@linux.dev \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®