Skip to content

Commit 35d5c8b

Browse files
kwan-intcdledford
authored andcommitted
IB/hfi1: Unsafe PSN checking for TID RDMA READ Resp packet
When processing a TID RDMA READ RESP packet that causes KDETH EFLAGS errors, the packet's IB PSN is checked against qp->s_last_psn and qp->s_psn without the protection of qp->s_lock, which is not safe. This patch fixes the issue by acquiring qp->s_lock first. Fixes: 9905bf0 ("IB/hfi1: Add functions to receive TID RDMA READ response") Cc: <[email protected]> Reviewed-by: Mike Marciniszyn <[email protected]> Signed-off-by: Kaike Wan <[email protected]> Signed-off-by: Dennis Dalessandro <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Doug Ledford <[email protected]>
1 parent d58c183 commit 35d5c8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/infiniband/hw/hfi1/tid_rdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,12 +2687,12 @@ static bool handle_read_kdeth_eflags(struct hfi1_ctxtdata *rcd,
26872687
u32 fpsn;
26882688

26892689
lockdep_assert_held(&qp->r_lock);
2690+
spin_lock(&qp->s_lock);
26902691
/* If the psn is out of valid range, drop the packet */
26912692
if (cmp_psn(ibpsn, qp->s_last_psn) < 0 ||
26922693
cmp_psn(ibpsn, qp->s_psn) > 0)
2693-
return ret;
2694+
goto s_unlock;
26942695

2695-
spin_lock(&qp->s_lock);
26962696
/*
26972697
* Note that NAKs implicitly ACK outstanding SEND and RDMA write
26982698
* requests and implicitly NAK RDMA read and atomic requests issued

0 commit comments

Comments
 (0)