RDMA/bnxt_re: Remove the qp from list only if the qp destroy succeeds
authorSelvin Xavier <selvin.xavier@broadcom.com>
Mon, 24 Aug 2020 18:14:31 +0000 (11:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Sep 2020 11:55:27 +0000 (13:55 +0200)
commit6716ed0d4e1139bb30e473395fc712af821fcac0
tree35031132cf8b1eb4dc2039c42324cdd3ee6027ce
parentf51174da6e5137736e25e36946671ab885b39450
RDMA/bnxt_re: Remove the qp from list only if the qp destroy succeeds

[ Upstream commit 097a9d23b7250355b182c5fd47dd4c55b22b1c33 ]

Driver crashes when destroy_qp is re-tried because of an error
returned. This is because the qp entry was removed from the qp list during
the first call.

Remove qp from the list only if destroy_qp returns success.

The driver will still trigger a WARN_ON due to the memory leaking, but at
least it isn't corrupting memory too.

Fixes: 8dae419f9ec7 ("RDMA/bnxt_re: Refactor queue pair creation code")
Link: https://lore.kernel.org/r/1598292876-26529-2-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/bnxt_re/ib_verbs.c