Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319469pxb; Mon, 20 Sep 2021 18:42:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVMQpHydBM66J8mydacCKAvLRTb0rX36GYmb6ZaMf8jBBF+QJMtF5KMhj7BmwDA52VMMHO X-Received: by 2002:a02:9f83:: with SMTP id a3mr5058071jam.8.1632188556611; Mon, 20 Sep 2021 18:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188556; cv=none; d=google.com; s=arc-20160816; b=zLQMLomNzkHyPo7W9LcZIqXRyC4ShcXC1uDPp2N+vrlLrrMjYAxjkhzA+PF4GrxKaX iJYUYJqHSEdmq/Rp1qg7kLAkr+l7cOhk+/xBMZPteH4XqXpZrtbINcjFZngYMcE4NW9i aIjBw/K+iiC2B1PCnQ4Sn1CfB7UsrjPv9nPyMAAhgnNgm6PEZGmDkXNTPVsC6cG3wK7A 6NRe8xW75m9r6r2XzD/PXme+xGmpw6RRsS+25oO5adizjH+LLSAutMXuDlpoVv0uTVnb wXw8OPx3RB6cx3LMY9OEXXeVE+TWMHvS528flZtySgK3NdjJhbc8vs+8jYy+av+DNuBu 7Nvw== 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=dR70vrKvqPTsBv21iW29+YozOp2dyUWMchkQ2s1/2Sc=; b=iX3jgPygbwS8TkGT+ewCQ3Bk9xH1aqNTbeVqKbSXj+VOni1g9wwosiHctmxxbZVUam RRJpOBZ6SQeBASmm3bE1AqRIbU7Hl5dYAxSFAEi61jsUJiGGOSPbpZZrk+0cxPvUvrQr kYsLOvqp9T/Z4a4NnbSBi1YoP3IIxfFjRW2HUZh3OnwZzi+kU2EF/qluKm3H7TMKaJ3i eGbkqNMH8ge/z8Cl7ka5EEhJw/3P4bsKSpbk53b7GLSq1pEJ4Qeuh8mRV8l8ABTHHU3/ 21FS6uGMcvh6IZlec3yt/H+S28uf5KOza5NG1W5rnUDbmV3Okwp6/4HObiSd4HObwHd/ b21w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AEUcsaXP; 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 s10si13729266ioo.6.2021.09.20.18.42.25; Mon, 20 Sep 2021 18:42:36 -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=AEUcsaXP; 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 S229705AbhITQum (ORCPT + 99 others); Mon, 20 Sep 2021 12:50:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:37068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244104AbhITQtK (ORCPT ); Mon, 20 Sep 2021 12:49:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E07A61242; Mon, 20 Sep 2021 16:47:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156460; bh=wWYN6TOqooXpSHMj8jRxU3SF8EFAxjzBm2Q4EXJ5fXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AEUcsaXP+S/9pEi1ShbFuoXWzbkWVZTJDLL7cvI/6TVi3Jqn1PMuLnXEToQmDBOgT bkoMM+g2rZuplL62MBkK5rljB8wC5ta8hESQpMU0LivM7slj9pPyrZRoBSdLPoikFX e8dmkdkNILBXubz3yZlzs+ze/mVyI2ee83Zx+MbA= 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 4.4 070/133] clk: kirkwood: Fix a clocking boot regression Date: Mon, 20 Sep 2021 18:42:28 +0200 Message-Id: <20210920163914.938701750@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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 @@ -254,6 +254,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 }, + { } }; #define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)