]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: hinic: Fix cleanup in create_rxqs/txqs()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 13 Dec 2024 14:28:11 +0000 (17:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:24:52 +0000 (13:24 +0100)
commit1942218bf95ff2a4dc6ad76bac93446561846a28
tree128b0d41135f5107c6111da3c8a8243e6ec98fee
parent64f3f7388b9028b0a36fb526d7b838bf3add7a5a
net: hinic: Fix cleanup in create_rxqs/txqs()

[ Upstream commit 7203d10e93b6e6e1d19481ef7907de6a9133a467 ]

There is a check for NULL at the start of create_txqs() and
create_rxqs() which tess if "nic_dev->txqs" is non-NULL.  The
intention is that if the device is already open and the queues
are already created then we don't create them a second time.

However, the bug is that if we have an error in the create_txqs()
then the pointer doesn't get set back to NULL.  The NULL check
at the start of the function will say that it's already open when
it's not and the device can't be used.

Set ->txqs back to NULL on cleanup on error.

Fixes: c3e79baf1b03 ("net-next/hinic: Add logical Txq and Rxq")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/0cc98faf-a0ed-4565-a55b-0fa2734bc205@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/huawei/hinic/hinic_main.c