linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] [media] ddbridge: Do not free_irq() if request_irq() failed
@ 2015-05-27 14:28 Takeshi Yoshimura
  0 siblings, 0 replies; only message in thread
From: Takeshi Yoshimura @ 2015-05-27 14:28 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Markus Elfring, Christopher Reimer,
	Hans Verkuil, linux-media
  Cc: linux-kernel, Takeshi Yoshimura

From: Takeshi Yoshimura <yos@sslab.ics.keio.ac.jp>

My static checker detected that free_irq() is called even after 
request_irq() failed in ddb_probe(). In this case, the kernel may try to 
free dev->pdev->irq although the IRQ is not assigned. This event rarely 
occurs, but always introduces a warning if it happens.

"goto fail1" always results in disabling enabled MSI and releasing a 
requested IRQ. It seems like the former handling is necessary. So I added
a conditional branch before the free_irq() (stat == 0 means request_irq() 
succeeds).

Signed-off-by: Takeshi Yoshimura <yos@sslab.ics.keio.ac.jp>
---
 drivers/media/pci/ddbridge/ddbridge-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index 9e3492e..0ac2dd3 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -1630,7 +1630,8 @@ fail1:
 	printk(KERN_ERR "fail1\n");
 	if (dev->msi)
 		pci_disable_msi(dev->pdev);
-	free_irq(dev->pdev->irq, dev);
+	if (stat == 0)
+		free_irq(dev->pdev->irq, dev);
 fail:
 	printk(KERN_ERR "fail\n");
 	ddb_unmap(dev);
-- 
2.1.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-05-27 14:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27 14:28 [PATCH 1/1] [media] ddbridge: Do not free_irq() if request_irq() failed Takeshi Yoshimura

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).