Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6017124pxb; Mon, 14 Feb 2022 13:13:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzT8yG2x6qjjsxo/CYeqp6a8drTRh2FsIW4iyybkF4HhnrEN8cOOX/9GMbyV8rDg4JygMt0 X-Received: by 2002:aa7:800a:: with SMTP id j10mr1030923pfi.28.1644873214272; Mon, 14 Feb 2022 13:13:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873214; cv=none; d=google.com; s=arc-20160816; b=QfeMQcYkw99QFtPcQVmZ1W9YtFS9u1oa+9sMiemwtwhm23l4Mw9Qan1Z3mOV4eOrmv pz9TFr9LYo15VvkVF1FhkFjv9n7T7n/aJdPWcGxxGWDRlr7nfw8eVyyd5rhXl2MiwoHV g81fXd5TNBhZItM36NprQw9mMiGwtQ7W310O8tz0ieN4J3DKcmw3SSRvQQefDTsRbnbc aCbc7OmdnCe52B5iLeAMIId1DWacuUMSWdlWo8FS249m1m0it/hbqts9Ft2Lu/Aut2wZ C3WfyJtS9+zaEKc3Qe4H1yaFMT0oO2Yh+M7sxIcEwvMyzEJS7hVyiMa7D3ceFEakAm+Q 3+og== 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=2Rt6yB1EQ0AORp+2UDLzn7pdseWfPe7UGOCfhgUdWys=; b=OIIh+YeT0gTNXElojk5x+kcE+j3YR5Hoj9CqVd+JCsV25WYiJGCmJXhPI8sBkJg67p b8+xZmGvFZOuCXZP2rhuRCl60wG0pNvh9ZghRKu2dsOIbDomq5gpDwJjLWGBUqOKnbN1 gRUe+AW2zzhDtiNbDxTYtyULywjzNfVUFUrl/dPalmCdX7iw7eArDJ9AO6i2H8cpj9qQ CPhePDwMu1FY7Z5TD0S7DLy5gMokY088/XjHKWKCORIWdREsHY/wD6Mcne4CyDXs6vGa PL5773MJ9wr8exjjhiNc/JVUlFoEpWNJpbBedUNBdJSVDqykaAZUrCnWsN/fMYAtcGN6 1Muw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JB8AOctl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e19si6642519pjh.61.2022.02.14.13.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:13:34 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JB8AOctl; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0E62F1480D9; Mon, 14 Feb 2022 12:32:45 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346589AbiBNKPy (ORCPT + 99 others); Mon, 14 Feb 2022 05:15:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345891AbiBNKOL (ORCPT ); Mon, 14 Feb 2022 05:14:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6776667355; Mon, 14 Feb 2022 01:52:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F18F360DFE; Mon, 14 Feb 2022 09:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2A9CC36AE3; Mon, 14 Feb 2022 09:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832339; bh=4Ww7YY60vIbpvXUj1vAzBR+a7Waun+OVFOKjDCpCtdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JB8AOctlOyCzmRQW1m0DkCtdGzCW+lI4k8FeVGCOQLtldewt2a/cas1v0x/gJBIvz 6ntF+T63xIs0R9uoyvi/ARikRDWVcR5aD8s4vxLf+C1J14ja11/hkkSWTlRC1jpw+m Dqp+SNCrb2ikOEuF/v5uD2JrWe8dbT186df3r5aE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kishon Vijay Abraham I , Vinod Koul Subject: [PATCH 5.15 155/172] phy: ti: Fix missing sentinel for clk_div_table Date: Mon, 14 Feb 2022 10:26:53 +0100 Message-Id: <20220214092511.752273580@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092506.354292783@linuxfoundation.org> References: <20220214092506.354292783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kishon Vijay Abraham I commit 6d1e6bcb31663ee83aaea1f171f3dbfe95dd4a69 upstream. _get_table_maxdiv() tries to access "clk_div_table" array out of bound defined in phy-j721e-wiz.c. Add a sentinel entry to prevent the following global-out-of-bounds error reported by enabling KASAN. [ 9.552392] BUG: KASAN: global-out-of-bounds in _get_maxdiv+0xc0/0x148 [ 9.558948] Read of size 4 at addr ffff8000095b25a4 by task kworker/u4:1/38 [ 9.565926] [ 9.567441] CPU: 1 PID: 38 Comm: kworker/u4:1 Not tainted 5.16.0-116492-gdaadb3bd0e8d-dirty #360 [ 9.576242] Hardware name: Texas Instruments J721e EVM (DT) [ 9.581832] Workqueue: events_unbound deferred_probe_work_func [ 9.587708] Call trace: [ 9.590174] dump_backtrace+0x20c/0x218 [ 9.594038] show_stack+0x18/0x68 [ 9.597375] dump_stack_lvl+0x9c/0xd8 [ 9.601062] print_address_description.constprop.0+0x78/0x334 [ 9.606830] kasan_report+0x1f0/0x260 [ 9.610517] __asan_load4+0x9c/0xd8 [ 9.614030] _get_maxdiv+0xc0/0x148 [ 9.617540] divider_determine_rate+0x88/0x488 [ 9.622005] divider_round_rate_parent+0xc8/0x124 [ 9.626729] wiz_clk_div_round_rate+0x54/0x68 [ 9.631113] clk_core_determine_round_nolock+0x124/0x158 [ 9.636448] clk_core_round_rate_nolock+0x68/0x138 [ 9.641260] clk_core_set_rate_nolock+0x268/0x3a8 [ 9.645987] clk_set_rate+0x50/0xa8 [ 9.649499] cdns_sierra_phy_init+0x88/0x248 [ 9.653794] phy_init+0x98/0x108 [ 9.657046] cdns_pcie_enable_phy+0xa0/0x170 [ 9.661340] cdns_pcie_init_phy+0x250/0x2b0 [ 9.665546] j721e_pcie_probe+0x4b8/0x798 [ 9.669579] platform_probe+0x8c/0x108 [ 9.673350] really_probe+0x114/0x630 [ 9.677037] __driver_probe_device+0x18c/0x220 [ 9.681505] driver_probe_device+0xac/0x150 [ 9.685712] __device_attach_driver+0xec/0x170 [ 9.690178] bus_for_each_drv+0xf0/0x158 [ 9.694124] __device_attach+0x184/0x210 [ 9.698070] device_initial_probe+0x14/0x20 [ 9.702277] bus_probe_device+0xec/0x100 [ 9.706223] deferred_probe_work_func+0x124/0x180 [ 9.710951] process_one_work+0x4b0/0xbc0 [ 9.714983] worker_thread+0x74/0x5d0 [ 9.718668] kthread+0x214/0x230 [ 9.721919] ret_from_fork+0x10/0x20 [ 9.725520] [ 9.727032] The buggy address belongs to the variable: [ 9.732183] clk_div_table+0x24/0x440 Fixes: 091876cc355d ("phy: ti: j721e-wiz: Add support for WIZ module present in TI J721E SoC") Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Kishon Vijay Abraham I Link: https://lore.kernel.org/r/20220117110108.4117-1-kishon@ti.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/phy/ti/phy-j721e-wiz.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -233,6 +233,7 @@ static const struct clk_div_table clk_di { .val = 1, .div = 2, }, { .val = 2, .div = 4, }, { .val = 3, .div = 8, }, + { /* sentinel */ }, }; static const struct wiz_clk_div_sel clk_div_sel[] = {