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: 659367 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FE1CC6FD1D for ; Mon, 6 Mar 2023 10:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbjCFKJ3 (ORCPT ); Mon, 6 Mar 2023 05:09:29 -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 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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);