Patch "RDMA/hns: Add a check for current state before modifying QP" has been added to the 5.4-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: Add a check for current state before modifying QP

to the 5.4-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-add-a-check-for-current-state-before-modify.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 7e9b9f02dbf326d38a1bf505d2f6cba53b52e357
Author: Lang Cheng <chenglang@xxxxxxxxxx>
Date:   Tue Aug 25 19:07:54 2020 +0800

    RDMA/hns: Add a check for current state before modifying QP
    
    [ Upstream commit e0ef0f68c4c0d85b1eb63f38d5d10324361280e8 ]
    
    It should be considered an illegal operation if the ULP attempts to modify
    a QP from another state to the current hardware state. Otherwise, the ULP
    can modify some fields of QPC at any time. For example, for a QP in state
    of RTS, modify it from RTR to RTS can change the PSN, which is always not
    as expected.
    
    Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
    Link: https://lore.kernel.org/r/1598353674-24270-1-git-send-email-liweihang@xxxxxxxxxx
    Signed-off-by: Lang Cheng <chenglang@xxxxxxxxxx>
    Signed-off-by: Weihang Li <liweihang@xxxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index 8dd2d666f6875..730e50c87a760 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -1181,8 +1181,10 @@ int hns_roce_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
 	mutex_lock(&hr_qp->mutex);
 
-	cur_state = attr_mask & IB_QP_CUR_STATE ?
-		    attr->cur_qp_state : (enum ib_qp_state)hr_qp->state;
+	if (attr_mask & IB_QP_CUR_STATE && attr->cur_qp_state != hr_qp->state)
+		goto out;
+
+	cur_state = hr_qp->state;
 	new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state;
 
 	if (ibqp->uobject &&



[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