Skip to content

Commit 2342ae1

Browse files
tititiou36davem330
authored andcommitted
gve: Fix an error handling path in 'gve_probe()'
If the 'register_netdev() call fails, we must release the resources allocated by the previous 'gve_init_priv()' call, as already done in the remove function. Add a new label and the missing 'gve_teardown_priv_resources()' in the error handling path. Fixes: 893ce44 ("gve: Add basic driver framework for Compute Engine Virtual NIC") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Catherine Sullivan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aa3cf24 commit 2342ae1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/ethernet/google/gve/gve_main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1565,14 +1565,17 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
15651565

15661566
err = register_netdev(dev);
15671567
if (err)
1568-
goto abort_with_wq;
1568+
goto abort_with_gve_init;
15691569

15701570
dev_info(&pdev->dev, "GVE version %s\n", gve_version_str);
15711571
dev_info(&pdev->dev, "GVE queue format %d\n", (int)priv->queue_format);
15721572
gve_clear_probe_in_progress(priv);
15731573
queue_work(priv->gve_wq, &priv->service_task);
15741574
return 0;
15751575

1576+
abort_with_gve_init:
1577+
gve_teardown_priv_resources(priv);
1578+
15761579
abort_with_wq:
15771580
destroy_workqueue(priv->gve_wq);
15781581

0 commit comments

Comments
 (0)