From patchwork Wed May 18 19:36:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 68056 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2816699qge; Wed, 18 May 2016 12:36:55 -0700 (PDT) X-Received: by 10.98.69.132 with SMTP id n4mr13331850pfi.53.1463600215843; Wed, 18 May 2016 12:36:55 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x63si13928162pfb.123.2016.05.18.12.36.55; Wed, 18 May 2016 12:36:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753129AbcERTgy (ORCPT + 7 others); Wed, 18 May 2016 15:36:54 -0400 Received: from mail.kernel.org ([198.145.29.136]:60549 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbcERTgx (ORCPT ); Wed, 18 May 2016 15:36:53 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7C9E620221; Wed, 18 May 2016 19:36:52 +0000 (UTC) Received: from mail-yw0-f171.google.com (mail-yw0-f171.google.com [209.85.161.171]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A8FC62034E; Wed, 18 May 2016 19:36:51 +0000 (UTC) Received: by mail-yw0-f171.google.com with SMTP id x194so58821985ywd.0; Wed, 18 May 2016 12:36:51 -0700 (PDT) X-Gm-Message-State: AOPr4FVT8Q9hR+2odjvSy1kVaw/yiOgdvOmrDBqbeoWfWbuD2/21IyfhCzu9hc1438alNzfWdqlPHNs/O1LpXg== X-Received: by 10.37.13.69 with SMTP id 66mr4075986ybn.163.1463600210990; Wed, 18 May 2016 12:36:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.223.140 with HTTP; Wed, 18 May 2016 12:36:31 -0700 (PDT) In-Reply-To: <573C8B6C.6030900@oracle.com> References: <573C8B6C.6030900@oracle.com> From: Rob Herring Date: Wed, 18 May 2016 14:36:31 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: drivers/of: crash on boot To: Sasha Levin , Rhyland Klein , Gavin Shan Cc: LKML , Grant Likely , "devicetree@vger.kernel.org" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, May 18, 2016 at 10:34 AM, Sasha Levin wrote: > Hi Rhyland, > > I'm seeing a crash on boot that seems to have been caused by > "drivers/of: Fix depth when unflattening devicetree": > > [ 61.145229] ================================================================== > > [ 61.147588] BUG: KASAN: stack-out-of-bounds in unflatten_dt_nodes+0x11d2/0x1290 at addr ffff88005b30777c The following appears to fix it for me. Rhyland, please confirm. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 7f38241..888ec2a 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -409,7 +409,7 @@ static int unflatten_dt_nodes(const void *blob, fpsizes[depth] = dad ? strlen(of_node_full_name(dad)) : 0; nps[depth+1] = dad; for (offset = 0; - offset >= 0; + offset >= 0, depth >= 0; offset = fdt_next_node(blob, offset, &depth)) { if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH)) continue;