linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: mroos@linux.ee
Cc: sam@ravnborg.org, tj@kernel.org, grant.likely@secretlab.ca,
	rob.herring@calxeda.com, sparclinux@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: OF-related boot crash in 3.3.0-rc3-00188-g3ec1e88
Date: Tue, 28 Feb 2012 16:10:23 -0500 (EST)	[thread overview]
Message-ID: <20120228.161023.117381282430807415.davem@davemloft.net> (raw)
In-Reply-To: <20120227.163044.2168482307021109001.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Mon, 27 Feb 2012 16:30:44 -0500 (EST)

> I think the issue is that OF writes past the end of the buffer even
> though the length it reports is smaller than what it writes.

Meelis, can you get your tree back into a state where the crash happens
and then add the following debugging patch and see what happens?

Thanks!

diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
index 07cc1d6..367ef33 100644
--- a/drivers/of/pdt.c
+++ b/drivers/of/pdt.c
@@ -125,12 +125,31 @@ static struct property * __init of_pdt_build_one_prop(phandle node, char *prev,
 		} else {
 			int len;
 
+#if 1
+			int i;
+			p->value = prom_early_alloc(p->length + 1 + 64);
+			for (i = p->length + 1; i < p->length + 1 + 64; i++)
+				((unsigned char *)p->value)[i] = 0xff;
+#else
 			p->value = prom_early_alloc(p->length + 1);
+#endif
 			len = of_pdt_prom_ops->getproperty(node, p->name,
 					p->value, p->length);
-			if (len <= 0)
+			if (len <= 0) {
+				pr_info("OF BUG: getproperty(%s, %d) returns %d\n",
+					p->name, p->length, len);
 				p->length = 0;
+			}
 			((unsigned char *)p->value)[p->length] = '\0';
+#if 1
+			for (i = p->length + 1; i < p->length + 1 + 64; i++) {
+				if (((unsigned char *)p->value)[i] != 0xff) {
+					pr_info("OF BUG: Write past end of property buffer\n");
+					pr_info("OF BUG: Property name [%s] length [%d] getprop len [%d]\n",
+						p->name, p->length, len);
+				}
+			}
+#endif
 		}
 	}
 	return p;
@@ -161,7 +180,11 @@ static char * __init of_pdt_get_one_property(phandle node, const char *name)
 
 	len = of_pdt_prom_ops->getproplen(node, name);
 	if (len > 0) {
+#if 1
+		buf = prom_early_alloc(len + 64);
+#else
 		buf = prom_early_alloc(len);
+#endif
 		len = of_pdt_prom_ops->getproperty(node, name, buf, len);
 	}
 

  reply	other threads:[~2012-02-28 21:10 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 20:56 [PATCH v3.3-rc5] memblock: Fix size aligning of memblock_alloc_base_nid() Tejun Heo
2012-02-13  7:45 ` OF-related boot crash in 3.3.0-rc3-00188-g3ec1e88 Meelis Roos
2012-02-13  8:06   ` Grant Likely
2012-02-13  9:20     ` Meelis Roos
2012-02-13 21:46       ` Grant Likely
2012-02-14  0:58         ` David Miller
2012-02-14  2:30           ` Grant Likely
2012-02-14  2:41             ` Grant Likely
2012-02-16 21:08             ` mroos
2012-02-14  5:54           ` mroos
2012-02-16 19:53         ` Meelis Roos
2012-02-16 21:23           ` Sam Ravnborg
2012-02-20  9:11           ` Meelis Roos
2012-02-20 17:06             ` Tejun Heo
2012-02-20 20:04               ` Meelis Roos
2012-02-20 21:01                 ` Tejun Heo
2012-02-20 22:32               ` Meelis Roos
2012-02-21  1:05                 ` Tejun Heo
2012-02-22  0:36                   ` Meelis Roos
2012-02-22 17:48                     ` Tejun Heo
2012-02-22 18:25                       ` Meelis Roos
2012-02-23 18:55                         ` Tejun Heo
2012-02-23 23:31                           ` David Miller
2012-02-24  9:20                           ` Meelis Roos
2012-02-27 17:17                             ` Meelis Roos
2012-02-27 19:43                               ` Sam Ravnborg
2012-02-27 21:25                                 ` Meelis Roos
2012-02-27 21:30                                   ` David Miller
2012-02-28 21:10                                     ` David Miller [this message]
2012-02-28 21:36                                       ` Meelis Roos
2012-02-28 22:56                                         ` David Miller
2012-02-29  6:15                                           ` Meelis Roos
2012-02-29  6:27                                             ` David Miller
2012-02-22 20:44                       ` David Miller
2012-02-22 21:00                         ` Tejun Heo
2012-02-22 18:22                     ` Richard Mortimer
2012-02-22 20:26                       ` David Miller
2012-02-22 17:03                   ` Sam Ravnborg
2012-02-22 17:12                     ` Meelis Roos
2012-02-22 17:21                       ` Sam Ravnborg
2012-02-22 17:41                         ` Meelis Roos
2012-02-13  9:50     ` Meelis Roos
2012-02-13  9:51       ` Meelis Roos
2012-02-13 10:35       ` Meelis Roos
2012-03-01 12:24   ` [tip:core/urgent] memblock: Fix size aligning of memblock_alloc_base_nid() tip-bot for Tejun Heo
2012-02-28 22:16 ` [PATCH v3.3-rc5] " Sam Ravnborg

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=20120228.161023.117381282430807415.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mroos@linux.ee \
    --cc=rob.herring@calxeda.com \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=tj@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).