Patch "RDMA/hns: fix memory leak in hns_roce_alloc_mr()" has been added to the 6.0-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/hns: fix memory leak in hns_roce_alloc_mr()

to the 6.0-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-hns-fix-memory-leak-in-hns_roce_alloc_mr.patch
and it can be found in the queue-6.0 subdirectory.

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



commit 02372d75cabd02c6ac561b3a52244656f37779f3
Author: Zhengchao Shao <shaozhengchao@xxxxxxxxxx>
Date:   Sat Nov 19 15:08:34 2022 +0800

    RDMA/hns: fix memory leak in hns_roce_alloc_mr()
    
    [ Upstream commit a115aa00b18f7b8982b8f458149632caf64a862a ]
    
    When hns_roce_mr_enable() failed in hns_roce_alloc_mr(), mr_key is not
    released. Compiled test only.
    
    Fixes: 9b2cf76c9f05 ("RDMA/hns: Optimize PBL buffer allocation process")
    Signed-off-by: Zhengchao Shao <shaozhengchao@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221119070834.48502-1-shaozhengchao@xxxxxxxxxx
    Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index dedfa56f5773..fb165069c8d9 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -392,10 +392,10 @@ struct ib_mr *hns_roce_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
 
 	return &mr->ibmr;
 
-err_key:
-	free_mr_key(hr_dev, mr);
 err_pbl:
 	free_mr_pbl(hr_dev, mr);
+err_key:
+	free_mr_key(hr_dev, mr);
 err_free:
 	kfree(mr);
 	return ERR_PTR(ret);



[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