linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] octeontx2-af: Fix a resource leak in an error handling path in 'cgx_probe()'
@ 2018-12-29 16:42 Christophe JAILLET
  2019-01-04 20:46 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2018-12-29 16:42 UTC (permalink / raw)
  To: sgoutham, lcherian, gakula, jerinj, davem
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

If an error occurs after the call to 'pci_alloc_irq_vectors()', we must
call 'pci_free_irq_vectors()' in order to avoid a	resource leak.

The same sequence is already in place in the corresponding 'cgx_remove()'
function.

Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index 742f0c1f60df..6d55e3d0b7ea 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -825,7 +825,7 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (!cgx->cgx_cmd_workq) {
 		dev_err(dev, "alloc workqueue failed for cgx cmd");
 		err = -ENOMEM;
-		goto err_release_regions;
+		goto err_free_irq_vectors;
 	}
 
 	list_add(&cgx->cgx_list, &cgx_list);
@@ -841,6 +841,8 @@ static int cgx_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 err_release_lmac:
 	cgx_lmac_exit(cgx);
 	list_del(&cgx->cgx_list);
+err_free_irq_vectors:
+	pci_free_irq_vectors(pdev);
 err_release_regions:
 	pci_release_regions(pdev);
 err_disable_device:
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] octeontx2-af: Fix a resource leak in an error handling path in 'cgx_probe()'
  2018-12-29 16:42 [PATCH] octeontx2-af: Fix a resource leak in an error handling path in 'cgx_probe()' Christophe JAILLET
@ 2019-01-04 20:46 ` David Miller
  2019-01-04 22:05   ` Christophe JAILLET
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-01-04 20:46 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: sgoutham, lcherian, gakula, jerinj, netdev, linux-kernel,
	kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Sat, 29 Dec 2018 17:42:22 +0100

> If an error occurs after the call to 'pci_alloc_irq_vectors()', we must
> call 'pci_free_irq_vectors()' in order to avoid a	resource leak.
> 
> The same sequence is already in place in the corresponding 'cgx_remove()'
> function.
> 
> Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied and queued up for -stable.

Please fix the date and time on your computer, putting improper dates into
the email headers of your patch postings makes your patch appear out
of order in my patchwork queue.

Thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] octeontx2-af: Fix a resource leak in an error handling path in 'cgx_probe()'
  2019-01-04 20:46 ` David Miller
@ 2019-01-04 22:05   ` Christophe JAILLET
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2019-01-04 22:05 UTC (permalink / raw)
  To: David Miller
  Cc: sgoutham, lcherian, gakula, jerinj, netdev, linux-kernel,
	kernel-janitors

Le 04/01/2019 à 21:46, David Miller a écrit :
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Date: Sat, 29 Dec 2018 17:42:22 +0100
>
>> If an error occurs after the call to 'pci_alloc_irq_vectors()', we must
>> call 'pci_free_irq_vectors()' in order to avoid a	resource leak.
>>
>> The same sequence is already in place in the corresponding 'cgx_remove()'
>> function.
>>
>> Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Applied and queued up for -stable.
>
> Please fix the date and time on your computer, putting improper dates into
> the email headers of your patch postings makes your patch appear out
> of order in my patchwork queue.
>
> Thank you.
>
Hi,

yes, I've spotted this time issue.
For some reason my VM get out of synch when restored from a saved state.
It was not the case before. It is likely due to an update of VirtualBox 
(i.e. 5.x --> 6.0) performed a few days ago.
Will try to give it a look.

For now, I have to manually do some ntpdate to get the time/date 
fixed... until the next save/restore of the VM.

Sorry for the inconvenience.

CJ


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-04 22:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-29 16:42 [PATCH] octeontx2-af: Fix a resource leak in an error handling path in 'cgx_probe()' Christophe JAILLET
2019-01-04 20:46 ` David Miller
2019-01-04 22:05   ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).