From patchwork Mon Mar 6 10:07:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1760665wrd; Mon, 6 Mar 2023 02:25:28 -0800 (PST) X-Google-Smtp-Source: AK7set+JFponFpFypcX73BHIOxDndoiEQjTbkgZv5QzcscZnLQ8riamXEOhxr+oSTGIkzUGDpsXu X-Received: by 2002:a17:906:10d8:b0:8aa:c2e1:6a64 with SMTP id v24-20020a17090610d800b008aac2e16a64mr11525527ejv.61.1678098328024; Mon, 06 Mar 2023 02:25:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098328; cv=none; d=google.com; s=arc-20160816; b=W62Pqbmnip76VBV2TKv8ctoaKj5noAIjS8Z3D3u0tMkWAij2q+BeWcjj9vC55ZEWxO d+IyWLDwpj9uPX5Ss/RutEqHaOR91foo8Aa6enfsEpF2gpBiYgaGUga6IoTllLsDKUM2 xAMclssVbJ/YWEtP9QGlWMDoBh7flzZ4u/8Um7t+7mZJG4457Vkv8QvsWWu4BE/pW9Px aqH9q93FTNmn56AwKzeRVhwKu9bGT91J7qscY6zhixAlrHxFb5QIW8KwKTXAFHBvYcZ0 TCGP2xm2xM/+IFfiX87UGq/gOM9FjoYvXxQDsWiPgBB6qyQm4W3NiGhBktAWLv2nkGdH DDkw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bGdTcXJvByR+LFOxTZ0by8ESuvFN3qQtnKeXR8A1lPo=; b=ToJ7hh95qOW/uyYXytH2+7bFstitVgriRngx+ShO9e6R/NDV5TE31gmTPtWoksMEMd XsUvnAcCvCBLB8nh82e7lbLpf+N9pxagxqWkXgLf+j7Et3n2o3hhHR4klSe+5bq6Myjs BNj9fTdOaDU5jgVQcOL2EpD5856Ob2cG56Xuh3lP7yAcYeZ7NnoQdKOK/OXwCbFlrY19 8FpihU/XdYUWcHCVuKDsSjBN9Y/OwECJQO68/32VUJ9ZJQEGm4x5XK4fQkX47GYO6uo6 dEbTWV+Ml4E9wyuqaDlcSOrV2o/PGTYX+pMlIrPrCjScrwRQ/9g6p6wQosnnVYV4+nQ2 PQWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JPL2f+tK; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz25-20020a170906cd1900b008d2b0211398si6185678ejb.534.2023.03.06.02.25.02; Mon, 06 Mar 2023 02:25:28 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=JPL2f+tK; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230411AbjCFKJr (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbjCFKJW (ORCPT ); Mon, 6 Mar 2023 05:09:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A44ED222CD; Mon, 6 Mar 2023 02:09:19 -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 4164B60C61; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97427C433A0; Mon, 6 Mar 2023 10:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678097358; bh=4+aatQXI0SCxRlCzdLvMFS4VkyXlIErsdSaIxooTjLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPL2f+tKt/HlM/ila+Orez2fDpuyMV0hIP4O874wDP4+xCQEchxA603rlXWnrkk6c kIEhbFdGw3uBtjiSVawaRUDsNzbaqqs2epRR19PgUyvgIIJSKvHc64VeqzFcc2s70N m+lcsfh5V86J88FjoMXYhgYwnqBf4RjYRYrTpsvy3YcZHelZJeE1MgiAbHVFdbBf07 pIO9ZEEo7VWv7jmcZfrGckJPQXErTytebZr3qfBgChPdP59WuZ9qEe7/Rrr2dbavO5 ZKgOMx1LSAWdzux+8TYBELjRKvLtaTIWj+k6h/te4YBGOz5AzKPvyJZ7n7XFYQ1g9w 20iTjSh2bjAAw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qi-9X; Mon, 06 Mar 2023 11:09:59 +0100 From: Johan Hovold To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Johan Hovold , stable@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 04/10] drm/msm: fix NULL-deref on irq uninstall Date: Mon, 6 Mar 2023 11:07:16 +0100 Message-Id: <20230306100722.28485-5-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306100722.28485-1-johan+linaro@kernel.org> References: <20230306100722.28485-1-johan+linaro@kernel.org> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759613632222395763?= X-GMAIL-MSGID: =?utf-8?q?1759613632222395763?= In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL. Fixes: f026e431cf86 ("drm/msm: Convert to Linux IRQ interfaces") Cc: stable@vger.kernel.org # 5.14 Cc: Thomas Zimmermann Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 17a59d73fe01..2f2bcdb671d2 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -251,9 +251,11 @@ static int msm_drm_uninit(struct device *dev) drm_bridge_remove(priv->bridges[i]); priv->num_bridges = 0; - pm_runtime_get_sync(dev); - msm_irq_uninstall(ddev); - pm_runtime_put_sync(dev); + if (kms) { + pm_runtime_get_sync(dev); + msm_irq_uninstall(ddev); + pm_runtime_put_sync(dev); + } if (kms && kms->funcs) kms->funcs->destroy(kms);