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]
Date:	Thu, 23 Aug 2012 17:10:00 +0300
From:	Peter Ujfalusi <peter.ujfalusi@...com>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	linux-kernel@...r.kernel.org, linux-omap@...r.kernel.org,
	Tony Lindgren <tony@...mide.com>,
	Paul Walmsley <paul@...an.com>, Kevin Hilman <khilman@...com>,
	Benoit Cousson <b-cousson@...com>
Subject: [PATCH] driver core: Check if r->name is valid in platform_get_resource_byname()

Safety check for the validity of the resource name before calling strcmp().
If the resource name is NULL do not compare it, just skip it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@...com>
---

Hi Greg,

I have experienced with a kernel crash because the r->name was NULL when booting
OMAP4+ kernel with devicetree.
I have sent a separate patch for the OMAP specific root (with analysis of the
issue):
http://marc.info/?l=linux-omap&m=134573006327647&w=2

I agree that it is unlikely to have the name NULL, but I think it does not hurt
if we do a safety check before comparing the strings.

Best Regards,
Peter

 drivers/base/platform.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index a1a7225..d717c2b 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -99,6 +99,9 @@ struct resource *platform_get_resource_byname(struct platform_device *dev,
 	for (i = 0; i < dev->num_resources; i++) {
 		struct resource *r = &dev->resource[i];
 
+		if (unlikely(!r->name))
+			continue;
+
 		if (type == resource_type(r) && !strcmp(r->name, name))
 			return r;
 	}
-- 
1.7.8.6

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