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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1397602574-28025-1-git-send-email-festevam@gmail.com>
Date:	Tue, 15 Apr 2014 19:56:14 -0300
From:	Fabio Estevam <festevam@...il.com>
To:	sameo@...ux.intel.com
Cc:	lee.jones@...aro.org, linux@....linux.org.uk,
	linux-kernel@...r.kernel.org,
	Fabio Estevam <fabio.estevam@...escale.com>
Subject: [PATCH v2] mfd: mc13xxx-core: Initialize the lock prior to using it

From: Fabio Estevam <fabio.estevam@...escale.com>

After request_threaded_irq() is called there is a chance that an interrupt
may occur before the 'mc13xxx->lock' is initialized, which will trigger a kernel
oops.

In order to prevent that, move the initialization of 'mc13xxx->lock' prior to
requesting the interrupts.

Suggested-by: Russell King <rmk+kernel@....linux.org.uk>
Signed-off-by: Fabio Estevam <fabio.estevam@...escale.com>
---
Changes since v1:
- Changed kernel warning --> kernel oops to better describe the problem
- Added Russell's Ack

 drivers/mfd/mc13xxx-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 06e64b6..9e296c4 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -660,13 +660,13 @@ int mc13xxx_common_init(struct device *dev)
 	if (ret)
 		return ret;
 
+	mutex_init(&mc13xxx->lock);
+
 	ret = request_threaded_irq(mc13xxx->irq, NULL, mc13xxx_irq_thread,
 			IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);
 	if (ret)
 		return ret;
 
-	mutex_init(&mc13xxx->lock);
-
 	if (mc13xxx_probe_flags_dt(mc13xxx) < 0 && pdata)
 		mc13xxx->flags = pdata->flags;
 
-- 
1.8.3.2

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