Skip to content

Commit 3bf3a7c

Browse files
zhijianli88jgunthorpe
authored andcommitted
RDMA/rtrs: Fix the last iu->buf leak in err path
The last iu->buf will leak if ib_dma_mapping_error() fails. Fixes: c0894b3 ("RDMA/rtrs: core: lib functions shared between client and server modules") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Li Zhijian <[email protected]> Acked-by: Guoqing Jiang <[email protected]> Acked-by: Jack Wang <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 5842d1d commit 3bf3a7c

File tree

1 file changed

+3
-1
lines changed
  • drivers/infiniband/ulp/rtrs

1 file changed

+3
-1
lines changed

drivers/infiniband/ulp/rtrs/rtrs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ struct rtrs_iu *rtrs_iu_alloc(u32 iu_num, size_t size, gfp_t gfp_mask,
3737
goto err;
3838

3939
iu->dma_addr = ib_dma_map_single(dma_dev, iu->buf, size, dir);
40-
if (ib_dma_mapping_error(dma_dev, iu->dma_addr))
40+
if (ib_dma_mapping_error(dma_dev, iu->dma_addr)) {
41+
kfree(iu->buf);
4142
goto err;
43+
}
4244

4345
iu->cqe.done = done;
4446
iu->size = size;

0 commit comments

Comments
 (0)