From patchwork Fri Jul 1 13:31:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12903326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47C09C433EF for ; Fri, 1 Jul 2022 13:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=/xqr9KB3BlYHv5XZYCVruQ3sa/qM2/8XtbOL46ca/64=; b=Pr1Gq6AQMVYyNT RAVZ5adCBhPYCc2I3Pkrc5wM10lCNZE1SRQTtquHftYXtmC7qNRspzXRNDmuohclBrdrlgRInu9SJ HPAqpNVrzFIUIVo3H5kN3Xm5O/KcMgeL6pxLHck2vxq8tQMmuoVY+w2v5BrN+8CB+HVUsymTG1jGQ X4bh4wM/oANg4UtfXO03KO1fjQ/5+uqVokhie5NFWuUVbTJZNvHVkEZFBwwbno+gl3MTOw1a7rNoK A/R6SQ44H3Aqg8mLT4/4zn114hF5WBCjl4pt2rsIzFCE7bPOtWcVHMggJeD3IX715WiKY5d7zFgVL f115DbBzYWaekrhccDtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7Gwg-0057j5-0X; Fri, 01 Jul 2022 13:44:30 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7GwZ-0057g4-4W for linux-arm-kernel@lists.infradead.org; Fri, 01 Jul 2022 13:44:24 +0000 Received: by mail-ej1-x629.google.com with SMTP id fi2so4142303ejb.9 for ; Fri, 01 Jul 2022 06:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GjlrXgSVfip4RUERiLeIPiEhdykTYrOkMAgjg1op1mc=; b=nlJNyqRjm4HaH7m5sfjgLw/CtWj5kx0oxnzWYDRqoRQtR2Cd7tZoLxi9FWMdVJmXkZ aKu387eKzm+9U7hE+FFcMd5dAhDAZNWhDHIhsIUW3rahzykjEBydCNtreZN8ypg4vQus kj8GOeiv7qgmgnnHKuwE6riw8VtnXFftb3K44bClPW1qSMDINo5JcxO6ZA1B0Ji4gDaK oCEmQDcHia0Pwz8lSGP4CJwkpACb8I0K1cWjeBRvxRtLhm769iXBSbQBmpal6sPqePqJ dXU7i6eOvLRhDdW1tsojm/PPG3RxCgBszKjWijcsw+DY5U1b0iNgTFAHDVY0UdK55/UV 0cOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GjlrXgSVfip4RUERiLeIPiEhdykTYrOkMAgjg1op1mc=; b=vdoYgvEOdjTTnp72ZH5wipkANnUw09AxFuRD23lUUE0K1Z1CLQE2g/5PBaeoimMRMJ 0+SM0YqEq8EGX7XgGw9LEcIC+Bj4aXiUjoRg6jX/Y2nQTYc6E/fS5mIlsawOUqXSAenz szfaesVxSsFC6gNRlUDpxI+93m8O24Np314Bzfo/CCmJmBP4U8b2tBlSV1hl1QQyZ9U4 07pDNHTRrTn5MX+zJWGtdgc2otWSUtyVC4xOPVt/QAWUOxmYxluk0RGxzlMmOkEIzMyz i+np2lGF+Zx6exzawrHlcJcG7QrpROxDGPiJJDDyz9+KrPjSMdQ5B2EIVywfJUktbmFe Yuew== X-Gm-Message-State: AJIora/d2vg02B1nOV8/mf3vmzbTS89NbBfQZsYPBFb8Tqgr192k6ZRB D5EQ4DZnFZiJyqED21bgrDw= X-Google-Smtp-Source: AGRyM1v1EvEsJAZzweGXnaZW5CIwk/ZPh7dZYGQ4CVU2YZ3BJ5bo0PShvbLQOmAhS3Q05MEjOAWybg== X-Received: by 2002:a17:906:29d:b0:6f0:18d8:7be0 with SMTP id 29-20020a170906029d00b006f018d87be0mr13750094ejf.561.1656683058468; Fri, 01 Jul 2022 06:44:18 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id g4-20020a170906868400b006fee98045cdsm10698220ejx.10.2022.07.01.06.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 06:44:18 -0700 (PDT) From: Christian Marangi To: Chanwoo Choi , MyungJoo Ham , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Christian Marangi , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Marek Szyprowski , stable@vger.kernel.org Subject: [PATCH v2] PM / devfreq: exynos-bus: Fix NULL pointer dereference Date: Fri, 1 Jul 2022 15:31:26 +0200 Message-Id: <20220701133126.26496-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220701_064423_228989_93732677 X-CRM114-Status: GOOD ( 14.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix exynos-bus NULL pointer dereference by correctly using the local generated freq_table to output the debug values instead of using the profile freq_table that is not used in the driver. Reported-by: Marek Szyprowski Tested-by: Marek Szyprowski Fixes: b5d281f6c16d ("PM / devfreq: Rework freq_table to be local to devfreq struct") Cc: stable@vger.kernel.org Signed-off-by: Christian Marangi Acked-by: Chanwoo Choi --- drivers/devfreq/exynos-bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index b5615e667e31..79725bbb4bb0 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -447,9 +447,9 @@ static int exynos_bus_probe(struct platform_device *pdev) } } - max_state = bus->devfreq->profile->max_state; - min_freq = (bus->devfreq->profile->freq_table[0] / 1000); - max_freq = (bus->devfreq->profile->freq_table[max_state - 1] / 1000); + max_state = bus->devfreq->max_state; + min_freq = (bus->devfreq->freq_table[0] / 1000); + max_freq = (bus->devfreq->freq_table[max_state - 1] / 1000); pr_info("exynos-bus: new bus device registered: %s (%6ld KHz ~ %6ld KHz)\n", dev_name(dev), min_freq, max_freq);