Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4457733rwb; Tue, 6 Sep 2022 07:49:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR5orlQpxIt7GYhKAtiZXkOGLsS48EkKeH82mi3icbx4ToWIy/mEIoVgg2uJo8oGppJY6ALl X-Received: by 2002:a05:6402:5202:b0:448:ab5d:3b89 with SMTP id s2-20020a056402520200b00448ab5d3b89mr33039984edd.343.1662475784216; Tue, 06 Sep 2022 07:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662475784; cv=none; d=google.com; s=arc-20160816; b=qMeSv1BlPgJIe1zms9MIWVhtAesIUSveguES735Uaw7E41w98xMP3UqZlUPScr7qt3 r7mHaTtTqtJGiLfK820JXOHVgYrVKyn5NyoZPstJlEHnS1/Quxd/VbUtTU0qUeA55cff HebyoUnzWFLzJ0FayLGQiPhGrfUzwJT+lTKptcmR0t/4wzdPCf/QCBv5+a77OhLhczQ+ eZ5NV+673jOBFtjE2E+FYXRusIZaNysqoCi55SjUYzQjoEXhbb9KEv6xvy+76zMRwBj0 G/Opo69SI+cpG9kvGnUCvQQIk52FzlszaY4fxiu1ZOsYWrzwsIFdRE3XAxawhwVKCSzH Y27Q== 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=VWAHbtsXBStbIzhqil+PX6MtT7UJzfMYD02Y6FWWXlc=; b=LKhnmA6iwi4nVkB7XST5OHNyf6vWYOj56RhC6i7kUFFa38FpcTvH/Qb5ib23H/DSnI oS6glOwkmt5xyHJ+tWqiLYM0V6zrJLULzRCjIZ+g5GlJClep8t0BvvHp1zt+tDhVeYk3 S6GOJy3fgCXP/nLeLl5NwpZWdYHrUnjpkCLA4N3SMhHc/skVsgEPbPs+cKyjAGlRsMGT lcKqAAyk6UK6ZOCXxpyFs7nsR2/AF6wXfjsDamYjgpjbj5jdb1LPM0ql/Rdy6/EYfT/W tQPSgERIItq80V8nJvc5mShjiyU1SNPAjiUm/7HwQfenuGoMJ2scVg31xYizIToqiX5v X8Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WwP9UWyc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a05640225c200b00447fd35d76csi9916885edb.615.2022.09.06.07.49.18; Tue, 06 Sep 2022 07:49:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WwP9UWyc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240903AbiIFOBH (ORCPT + 99 others); Tue, 6 Sep 2022 10:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239686AbiIFN5x (ORCPT ); Tue, 6 Sep 2022 09:57:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7585B83046; Tue, 6 Sep 2022 06:42:39 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 2E528B818CA; Tue, 6 Sep 2022 13:41:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76201C433D7; Tue, 6 Sep 2022 13:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662471702; bh=hxGNxGe/IBltjF0KY2GcNI/skUAd06JdyNar9iRoV30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwP9UWycstG3cSM7fJST+vCFKLuT31pMGD/geYNBq18d4Dol0M8Lnpd5nygG+Ua8M EAzkzq7LrycVzsbUWxJcEKs/yI+FCZrKuSIpq9wr+KgGHnDzPo+/E3/JeYM+EtGv9h 2Jk2SvMsMPKDZc1oZfKVTmjh02255G9j3WqWP7JA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Rob Clark , Dmitry Baryshkov , Rob Clark , Sasha Levin Subject: [PATCH 5.19 010/155] drm/msm/gpu: Drop qos request if devm_devfreq_add_device() fails Date: Tue, 6 Sep 2022 15:29:18 +0200 Message-Id: <20220906132829.861253056@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Bjorn Andersson [ Upstream commit 02b9f2636209beb843ca501d47f7fddc8792b2d7 ] In the event that devm_devfreq_add_device() fails the device's qos freq list is left referencing df->idle_freq and df->boost_freq. Attempting to initialize devfreq again after a probe deferral will then cause invalid memory accesses in dev_pm_qos_add_request(). Fix this by dropping the requests in the error path. Fixes: 7c0ffcd40b16 ("drm/msm/gpu: Respect PM QoS constraints") Signed-off-by: Bjorn Andersson Reviewed-by: Rob Clark Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/493001/ Link: https://lore.kernel.org/r/20220708162632.3529864-1-bjorn.andersson@linaro.org Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c index ea94bc18e72eb..89cc93eb67557 100644 --- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c +++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c @@ -213,6 +213,8 @@ void msm_devfreq_init(struct msm_gpu *gpu) if (IS_ERR(df->devfreq)) { DRM_DEV_ERROR(&gpu->pdev->dev, "Couldn't initialize GPU devfreq\n"); + dev_pm_qos_remove_request(&df->idle_freq); + dev_pm_qos_remove_request(&df->boost_freq); df->devfreq = NULL; return; } -- 2.35.1