Skip to content

Commit

Permalink
net: cxgb3_main: Fix a resource leak in a error path in 'init_one()'
Browse files Browse the repository at this point in the history
A call to 'kfree_skb()' is missing in the error handling path of
'init_one()'.
This is already present in 'remove_one()' but is missing here.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christophe JAILLET authored and David S. Miller committed Aug 6, 2019
1 parent 5c4e2e1 commit debea2c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3269,7 +3269,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (!adapter->regs) {
dev_err(&pdev->dev, "cannot map device registers\n");
err = -ENOMEM;
goto out_free_adapter;
goto out_free_adapter_nofail;
}

adapter->pdev = pdev;
Expand Down Expand Up @@ -3397,6 +3397,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (adapter->port[i])
free_netdev(adapter->port[i]);

out_free_adapter_nofail:
kfree_skb(adapter->nofail_skb);

out_free_adapter:
kfree(adapter);

Expand Down

0 comments on commit debea2c

Please sign in to comment.