Patch "RDMA/rtrs: Fix the last iu->buf leak in err path" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RDMA/rtrs: Fix the last iu->buf leak in err path

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-rtrs-fix-the-last-iu-buf-leak-in-err-path.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b4a73d9031378a1b8dfceec6ac378280df92e4c9
Author: Li Zhijian <lizhijian@xxxxxxxxxxx>
Date:   Tue Apr 25 01:02:42 2023 +0000

    RDMA/rtrs: Fix the last iu->buf leak in err path
    
    [ Upstream commit 3bf3a7c6985c625f64e73baefdaa36f1c2045a29 ]
    
    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")
    Link: https://lore.kernel.org/r/1682384563-2-3-git-send-email-lizhijian@xxxxxxxxxxx
    Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
    Acked-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxx>
    Acked-by: Jack Wang <jinpu.wang@xxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rtrs/rtrs.c
index 4da889103a5ff..4745f33d7104a 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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux