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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 28 Jul 2009 11:59:49 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Mike Frysinger <vapier@...too.org>
Cc:	Greg Kroah-Hartman <gregkh@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] driver core: simplify platform_get_resource()

On Mon, Jul 27, 2009 at 02:20:56PM -0400, Mike Frysinger wrote:
> The platform_get_resource() function takes a number for the desired index
> into the resource array, but then does a for loop on the array to get to
> that index.  Considering the array is linear, the loop overhead is just
> that -- overhead.  So unless I missed something, convert it into an index
> check and access the desired resource directly.  Resulting code makes a
> lot more sense considering its purpose.

This showed up in linux-next for me today and is causing breakage on at
least S3C64xx platforms since it changes the resource numbering when
there's more than one resource type for a device:

> -	for (i = 0; i < dev->num_resources; i++) {
> -		struct resource *r = &dev->resource[i];
> -
> -		if (type == resource_type(r) && num-- == 0)
> +	if (num >= 0 && num < dev->num_resources) {
> +		struct resource *r = &dev->resource[num];
> +		if (type == resource_type(r))

Previously the resources were indexed within their type (so you'd get
I/O resources 0, 1, ..., IRQ resources 0, 1, ... and so on) but now the
index treats all the resources for a device as a single array, causing
them to be renumbered for callers.

This causes drivers doing lookups by number to fail to find their
resources and not probe, causing widespread breakage.  Reverting the
patch fixes the problem.
--
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