lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1432736894-10368-1-git-send-email-yos@sslab.ics.keio.ac.jp>
Date:	Wed, 27 May 2015 14:28:14 +0000
From:	Takeshi Yoshimura <yos@...ab.ics.keio.ac.jp>
To:	Mauro Carvalho Chehab <mchehab@....samsung.com>,
	Markus Elfring <elfring@...rs.sourceforge.net>,
	Christopher Reimer <linux@...imer.net>,
	Hans Verkuil <hans.verkuil@...co.com>,
	linux-media@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org,
	Takeshi Yoshimura <yos@...ab.ics.keio.ac.jp>
Subject: [PATCH 1/1] [media] ddbridge: Do not free_irq() if request_irq() failed

From: Takeshi Yoshimura <yos@...ab.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@...ab.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ