net/smc: fix using of uninitialized completions
authorKarsten Graul <kgraul@linux.ibm.com>
Mon, 27 Dec 2021 13:35:30 +0000 (14:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jan 2022 11:42:35 +0000 (12:42 +0100)
commitcc70cbd3b1554b600a6cb10ae2bbbbb98f5f4956
tree197b43aa0405815d4862290e9caeffdbae3a8f14
parent75799e71df1da11394740b43ae5686646179561d
net/smc: fix using of uninitialized completions

[ Upstream commit 6d7373dabfd3933ee30c40fc8c09d2a788f6ece1 ]

In smc_wr_tx_send_wait() the completion on index specified by
pend->idx is initialized and after smc_wr_tx_send() was called the wait
for completion starts. pend->idx is used to get the correct index for
the wait, but the pend structure could already be cleared in
smc_wr_tx_process_cqe().
Introduce pnd_idx to hold and use a local copy of the correct index.

Fixes: 09c61d24f96d ("net/smc: wait for departure of an IB message")
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/smc/smc_wr.c