Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp23911pxb; Mon, 13 Sep 2021 11:56:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzA7uloS+ecJPh6vYXAR6tbVbkajL7tRxCG1Ursrsg4ftsXAkhvEYTeeyUaH+JgO+QkIP72 X-Received: by 2002:a02:1081:: with SMTP id 123mr5987925jay.83.1631559394640; Mon, 13 Sep 2021 11:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631559394; cv=none; d=google.com; s=arc-20160816; b=Ti1hJjgQOEHjbSfdjkvdN7B9CpYZwJkqDWVVZ/2ldIHS0VsbUmQLYxA9J50RORge5q /fJ4HpMa2Bk+oaHim8a+rApq/G8cYO/DyCYYOsipOethrj5OWGTVwh7jIY/qL0hUHmxH qLbUt+DMzswjeNQOekbNJ8SQQnuDd6LCYrnnXiIHmIwqDqmyv/U7ck1QgWmmLc5DsXbH qtlgtaC2eI+Zevl/uOR8fNc9GYWXxIW3MGrjbkbE84JCxaVicjxTISrNauszG16479KQ d/Cmm0kHEIpzaGeTOA6MdSBvEDyBPbFGuMtQyuzyYYywbyftYVbJzJcRgzRBcaMq6bp1 W2vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Q4axwxCVtJdFLOFVEcyx2zTbI6+iuCise205khc9EUA=; b=LBC5EGXbrqzDjrMJ+ARUOn8pGdWneT36T1Qw0M2mJB6q1WjQwgxmVK+gzGfVDXS+9I ezbFTZvPjebAmYxHm8cUkQUOqZDS4YFX49i0TS1kUEJ81w3vCShzDupuuvJW8hAVBqIZ ReSMCvrrHld/T08TEU/xhUyHU1yacNzntfdwiVoQ9xY0RDQqWwRAU7XR0NwV4jMtOWtK n+mpRpYYuB2AAzRQDMhYm0Qli3ZCfYMEepJAuSX0EmLZe8Irtoryt7lPK+IP/coZpyrK pf+8GhIJfdgUJOQkIpq2hcChecP53VJvoq/sSzD4Ch8Wdm1r9NhzumHEqtLpbaq9rcno fFxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=izedSLY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si7827035ilh.124.2021.09.13.11.56.22; Mon, 13 Sep 2021 11:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=izedSLY6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241989AbhIMN2a (ORCPT + 99 others); Mon, 13 Sep 2021 09:28:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:37736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241985AbhIMN0Z (ORCPT ); Mon, 13 Sep 2021 09:26:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 056E26113B; Mon, 13 Sep 2021 13:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539368; bh=jGWAl/K8bG2tdjP2RrtegwZ+kT089noGrVOSSSF+j2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izedSLY6SnmeqUqiWKOvnUHYDI5FINXC34SrRC61me/0y+MdmGTJrUDHZA7c/+yy7 /1dDnkC4v1nKGlS4WdnaC9G8rG8Ub/Dl0kFmxEHLjke79UnRPICET3ZAYX7Ejm9Poa ItuwxtX93QA9zg2i5jF9jp15VNX7RzigSg739Mmw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Lunn , Chris Packham , Gregory CLEMENT , Sebastian Hesselbarth , Linus Walleij , Stephen Boyd Subject: [PATCH 5.4 144/144] clk: kirkwood: Fix a clocking boot regression Date: Mon, 13 Sep 2021 15:15:25 +0200 Message-Id: <20210913131052.742733455@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131047.974309396@linuxfoundation.org> References: <20210913131047.974309396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Walleij commit aaedb9e00e5400220a8871180d23a83e67f29f63 upstream. Since a few kernel releases the Pogoplug 4 has crashed like this during boot: Unable to handle kernel NULL pointer dereference at virtual address 00000002 (...) [] (strlen) from [] (kstrdup+0x1c/0x4c) [] (kstrdup) from [] (__clk_register+0x44/0x37c) [] (__clk_register) from [] (clk_hw_register+0x20/0x44) [] (clk_hw_register) from [] (__clk_hw_register_mux+0x198/0x1e4) [] (__clk_hw_register_mux) from [] (clk_register_mux_table+0x5c/0x6c) [] (clk_register_mux_table) from [] (kirkwood_clk_muxing_setup.constprop.0+0x13c/0x1ac) [] (kirkwood_clk_muxing_setup.constprop.0) from [] (of_clk_init+0x12c/0x214) [] (of_clk_init) from [] (time_init+0x20/0x2c) [] (time_init) from [] (start_kernel+0x3dc/0x56c) [] (start_kernel) from [<00000000>] (0x0) Code: e3130020 1afffffb e12fff1e c08a1078 (e5d03000) This is because the "powersave" mux clock 0 was provided in an unterminated array, which is required by the loop in the driver: /* Count, allocate, and register clock muxes */ for (n = 0; desc[n].name;) n++; Here n will go out of bounds and then call clk_register_mux() on random memory contents after the mux clock. Fix this by terminating the array with a blank entry. Fixes: 105299381d87 ("cpufreq: kirkwood: use the powersave multiplexer") Cc: stable@vger.kernel.org Cc: Andrew Lunn Cc: Chris Packham Cc: Gregory CLEMENT Cc: Sebastian Hesselbarth Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20210814235514.403426-1-linus.walleij@linaro.org Reviewed-by: Andrew Lunn Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/clk/mvebu/kirkwood.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/clk/mvebu/kirkwood.c +++ b/drivers/clk/mvebu/kirkwood.c @@ -265,6 +265,7 @@ static const char *powersave_parents[] = static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = { { "powersave", powersave_parents, ARRAY_SIZE(powersave_parents), 11, 1, 0 }, + { } }; static struct clk *clk_muxing_get_src(