Skip to content

Commit 7203d10

Browse files
Dan Carpenterkuba-moo
authored andcommitted
net: hinic: Fix cleanup in create_rxqs/txqs()
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: c3e79ba ("net-next/hinic: Add logical Txq and Rxq") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e78c20f commit 7203d10

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/huawei/hinic/hinic_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ static int create_txqs(struct hinic_dev *nic_dev)
172172
hinic_sq_dbgfs_uninit(nic_dev);
173173

174174
devm_kfree(&netdev->dev, nic_dev->txqs);
175+
nic_dev->txqs = NULL;
175176
return err;
176177
}
177178

@@ -268,6 +269,7 @@ static int create_rxqs(struct hinic_dev *nic_dev)
268269
hinic_rq_dbgfs_uninit(nic_dev);
269270

270271
devm_kfree(&netdev->dev, nic_dev->rxqs);
272+
nic_dev->rxqs = NULL;
271273
return err;
272274
}
273275

0 commit comments

Comments
 (0)