public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.arm.linux.org.uk,
	linux-arm@vger.kernel.org
Cc: Mike Chan <mike@android.com>
Subject: [PATCH 01/13] [PATCH] OMAP: powerdomain: Fix overflow when doing powerdomain deps lookups.
Date: Sat, 15 Aug 2009 14:18:43 +0300	[thread overview]
Message-ID: <20090815111840.7384.20607.stgit@localhost.localdomain> (raw)
In-Reply-To: <20090815111704.7384.31564.stgit@localhost.localdomain>

At the end of the list pd is a pointer to a NULL struct, so checking
if the address == NULL doesn't help here. In fact the original code
will just keep running past the struct to read who knows what in
memory.

This case manifests itself when from clkdms_setup() when enabling auto
idle for a clock domain and the clockdomain usecount is greater than
0. When _clkdm_add_autodeps() tries to add the a dependency that does
not exist in the powerdomain->wkdep_srcs array the for loop will run
past the wkdep_srcs array.

Currently in linux-omap you won't hit this because the not found case
is never executed, unless you start modifying powerdomains and their
wakeup/sleep deps.

Signed-off-by: Mike Chan <mike@android.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/powerdomain.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 983f1cb..66206b6 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -83,7 +83,7 @@ static struct powerdomain *_pwrdm_deps_lookup(struct powerdomain *pwrdm,
 	if (!pwrdm || !deps || !omap_chip_is(pwrdm->omap_chip))
 		return ERR_PTR(-EINVAL);
 
-	for (pd = deps; pd; pd++) {
+	for (pd = deps; pd->pwrdm_name; pd++) {
 
 		if (!omap_chip_is(pd->omap_chip))
 			continue;
@@ -96,7 +96,7 @@ static struct powerdomain *_pwrdm_deps_lookup(struct powerdomain *pwrdm,
 
 	}
 
-	if (!pd)
+	if (!pd->pwrdm_name)
 		return ERR_PTR(-ENOENT);
 
 	return pd->pwrdm;



  reply	other threads:[~2009-08-15 11:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-15 11:18 [PATCH 00/13] OMAP PM, clock, and SDRC updates for the 2.6.32 merge window Paul Walmsley
2009-08-15 11:18 ` Paul Walmsley [this message]
2009-08-15 11:19 ` [PATCH 02/13] OMAP: SDRC: Add several new register definitions Paul Walmsley
2009-08-15 11:19 ` [PATCH 03/13] [PATCH] OMAP3 clock: Fixed processing of bootarg 'mpurate' Paul Walmsley
2009-08-15 11:19 ` [PATCH 04/13] OMAP2/3 clock: ensure each clock has a unique name Paul Walmsley
     [not found]   ` <20090815111944.7384.13541.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-08-17  8:47     ` Tony Lindgren
2009-08-17  9:14       ` Paul Walmsley
     [not found]         ` <alpine.DEB.2.00.0908170259250.18309-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2009-08-17  9:29           ` Russell King - ARM Linux
2009-08-17 10:06             ` Paul Walmsley
2009-08-17 10:24               ` Tony Lindgren
     [not found]               ` <alpine.DEB.2.00.0908170339380.7023-rwI8Ez+7Ko+d5PgPZx9QOdBPR1lH4CV8@public.gmane.org>
2009-08-17 16:59                 ` Russell King - ARM Linux
     [not found]                   ` <20090817165913.GS10764-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2009-08-17 17:37                     ` Paul Walmsley
2009-08-15 11:19 ` [PATCH 05/13] OMAP clock: add omap_clk_get_by_name() Paul Walmsley
2009-08-15 11:20 ` [PATCH 06/13] OMAP clock: associate MPU clocks with the mpu_clkdm Paul Walmsley
2009-08-15 11:20 ` [PATCH 07/13] OMAP3 clock: remove superfluous calls to omap2_init_clk_clkdm Paul Walmsley
2009-08-15 11:20 ` [PATCH 08/13] OMAP2/3 PM: create the OMAP PM interface and add a default OMAP PM no-op layer Paul Walmsley
2009-08-15 11:20 ` [PATCH 09/13] OMAP2/3/4 PRCM: add module IDLEST wait code Paul Walmsley
2009-08-15 11:20 ` [PATCH 10/13] OMAP2/3 board-*.c files: read bootloader configuration earlier Paul Walmsley
2009-08-15 11:20 ` [PATCH 11/13] OMAP2/3/4: create omap_hwmod layer Paul Walmsley
2009-08-15 11:20 ` [PATCH 12/13] OMAP: omap_hwmod: call omap_hwmod init at boot; create interconnects Paul Walmsley
2009-08-15 11:20 ` [PATCH 13/13] OMAP2/3/4 core: create omap_device layer Paul Walmsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090815111840.7384.20607.stgit@localhost.localdomain \
    --to=paul@pwsan.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-arm@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mike@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox