RDMA/cm: Spurious WARNING triggered in cm_destroy_id()
authorKa-Cheong Poon <ka-cheong.poon@oracle.com>
Wed, 3 Jun 2020 13:33:38 +0000 (06:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:49:03 +0000 (17:49 +0200)
commit0209ff0ef722bea9b111b831f50c09dfb895b143
tree90ec085589ed094863f6d6c9f719bc79f4648bcc
parent87331261b7040510689bcfd00bae85245d0c6fbe
RDMA/cm: Spurious WARNING triggered in cm_destroy_id()

[ Upstream commit fba97dc7fc76b2c9a909fa0b3786d30a9899f5cf ]

If the cm_id state is IB_CM_REP_SENT when cm_destroy_id() is called, it
calls cm_send_rej_locked().

In cm_send_rej_locked(), it calls cm_enter_timewait() and the state is
changed to IB_CM_TIMEWAIT.

Now back to cm_destroy_id(), it breaks from the switch statement, and the
next call is WARN_ON(cm_id->state != IB_CM_IDLE).

This triggers a spurious warning. Instead, the code should goto retest
after returning from cm_send_rej_locked() to move the state to IDLE.

Fixes: 67b3c8dceac6 ("RDMA/cm: Make sure the cm_id is in the IB_CM_IDLE state in destroy")
Link: https://lore.kernel.org/r/1591191218-9446-1-git-send-email-ka-cheong.poon@oracle.com
Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/cm.c