From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B61A8C4320A for ; Sun, 15 Aug 2021 14:40:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C93660BD3 for ; Sun, 15 Aug 2021 14:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237599AbhHOOlY (ORCPT ); Sun, 15 Aug 2021 10:41:24 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:50640 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbhHOOlY (ORCPT ); Sun, 15 Aug 2021 10:41:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=woQgBcJycESx1AeAnSauAxUXWqkWpB7nFh0pfKfcZmY=; b=m3+FpD8ujfk5GHSg7Vrz55uqww 4s14rKulOZvFjfWPA4JWlENJ0L5Fs+LFDMZ7rUq3qbiY983/75FiTGU7bfg/cG/gb1eJXuLxp5x0E D/82H+apjLHtbJMHeE3CAw2OE5RNmGn5HTxHGWN9kXKx9RqUGFJo6D1x7LM/eOP5wcn4=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1mFHJX-000FJa-3P; Sun, 15 Aug 2021 16:40:39 +0200 Date: Sun, 15 Aug 2021 16:40:39 +0200 From: Andrew Lunn To: Linus Walleij Cc: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, stable@vger.kernel.org, Chris Packham , Gregory CLEMENT , Sebastian Hesselbarth Subject: Re: [PATCH] clk: kirkwood: Fix a clocking boot regression Message-ID: References: <20210814235514.403426-1-linus.walleij@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210814235514.403426-1-linus.walleij@linaro.org> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Sun, Aug 15, 2021 at 01:55:14AM +0200, Linus Walleij wrote: > 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 Thanks Linus Reviewed-by: Andrew Lunn Andrew