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: <1447402460-2016-1-git-send-email-u.kleine-koenig@pengutronix.de>
Date:	Fri, 13 Nov 2015 09:14:20 +0100
From:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
To:	linux-kernel@...r.kernel.org,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	Corentin LABBE <clabbe.montjoie@...il.com>, kernel@...gutronix.de,
	Frans Klaver <fransklaver@...il.com>,
	devicetree@...r.kernel.org,
	Thierry Reding <thierry.reding@...il.com>
Subject: [PATCH] driver-core: platform: probe of-devices only using list of compatibles

There are several indications that make a platform device match a
platform driver. For devices that are instantiated by a device tree
matching by name, id table or acpi mechanisms doesn't make sense and
might result in surprising effects. So limit matching to use the
driver's of_match_table for these.

Acked-by: Thierry Reding <treding@...dia.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
---
Hello,

this issue popped up when it was discussed if of_match_device could
return NULL for several different drivers:

	http://mid.gmane.org/20151112082617.GE24008@pengutronix.de
	http://mid.gmane.org/20151112074447.GA24008@pengutronix.de
	http://mid.gmane.org/20151112134519.GJ24008@pengutronix.de

(and probably more that I'm not aware of). IMHO this doesn't make these
fixes obsolete, but YMMV.

Thierry: You gave your ack before I wrote a commit log. I added it
nevertheless and hope that's ok for you. If not please say so.

Best regards
Uwe

 drivers/base/platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 1dd6d3bf1098..09b2972e60d7 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -900,8 +900,8 @@ static int platform_match(struct device *dev, struct device_driver *drv)
 		return !strcmp(pdev->driver_override, drv->name);
 
 	/* Attempt an OF style match first */
-	if (of_driver_match_device(dev, drv))
-		return 1;
+	if (pdev->dev.of_node)
+		return of_driver_match_device(dev, drv);
 
 	/* Then try ACPI style match */
 	if (acpi_driver_match_device(dev, drv))
-- 
2.6.1

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