Patch "RDMA/hns: Fix NULL pointer problem in free_mr_init()" 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 NULL pointer problem in free_mr_init()

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-null-pointer-problem-in-free_mr_init.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 6026022b596281db988ef794c308fc11721f0d0b
Author: Yixing Liu <liuyixing1@xxxxxxxxxx>
Date:   Mon Oct 24 16:38:14 2022 +0800

    RDMA/hns: Fix NULL pointer problem in free_mr_init()
    
    [ Upstream commit 12bcaf87d8b66d8cd812479c8a6349dcb245375c ]
    
    Lock grab occurs in a concurrent scenario, resulting in stepping on a NULL
    pointer.  It should be init mutex_init() first before use the lock.
    
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
      Call trace:
       __mutex_lock.constprop.0+0xd0/0x5c0
       __mutex_lock_slowpath+0x1c/0x2c
       mutex_lock+0x44/0x50
       free_mr_send_cmd_to_hw+0x7c/0x1c0 [hns_roce_hw_v2]
       hns_roce_v2_dereg_mr+0x30/0x40 [hns_roce_hw_v2]
       hns_roce_dereg_mr+0x4c/0x130 [hns_roce_hw_v2]
       ib_dereg_mr_user+0x54/0x124
       uverbs_free_mr+0x24/0x30
       destroy_hw_idr_uobject+0x38/0x74
       uverbs_destroy_uobject+0x48/0x1c4
       uobj_destroy+0x74/0xcc
       ib_uverbs_cmd_verbs+0x368/0xbb0
       ib_uverbs_ioctl+0xec/0x1a4
       __arm64_sys_ioctl+0xb4/0x100
       invoke_syscall+0x50/0x120
       el0_svc_common.constprop.0+0x58/0x190
       do_el0_svc+0x30/0x90
       el0_svc+0x2c/0xb4
       el0t_64_sync_handler+0x1a4/0x1b0
       el0t_64_sync+0x19c/0x1a0
    
    Fixes: 70f92521584f ("RDMA/hns: Use the reserved loopback QPs to free MR before destroying MPT")
    Signed-off-by: Yixing Liu <liuyixing1@xxxxxxxxxx>
    Signed-off-by: Haoyue Xu <xuhaoyue1@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221024083814.1089722-3-xuhaoyue1@xxxxxxxxxxxxx
    Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 8507d788cc94..105888c6ccb7 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -2805,8 +2805,12 @@ static int free_mr_modify_qp(struct hns_roce_dev *hr_dev)
 
 static int free_mr_init(struct hns_roce_dev *hr_dev)
 {
+	struct hns_roce_v2_priv *priv = hr_dev->priv;
+	struct hns_roce_v2_free_mr *free_mr = &priv->free_mr;
 	int ret;
 
+	mutex_init(&free_mr->mutex);
+
 	ret = free_mr_alloc_res(hr_dev);
 	if (ret)
 		return 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