From patchwork Mon Mar 6 10:07:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 64581 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1761295wrd; Mon, 6 Mar 2023 02:27:13 -0800 (PST) X-Google-Smtp-Source: AK7set+cgeyBMmqAGw7mY60dTWg5C65xpo6vMUiud67FOYpi+sXgXV4/IVAqOQYvbex5pP+wUnOQ X-Received: by 2002:a17:907:8a06:b0:889:ed81:dff7 with SMTP id sc6-20020a1709078a0600b00889ed81dff7mr12960164ejc.9.1678098433550; Mon, 06 Mar 2023 02:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678098433; cv=none; d=google.com; s=arc-20160816; b=z0Aw2qJApnkeEX4BTO8S6/QauspxXTFbxs5aXlmXKrvmjgnyt10p4HGTYnOon+kCsz D3XkJxu/XyW72Jbc5dEl3Nd8ymno3f5lL3Brx87tyxi513P6qBm98+KoxNMW8LMns9UG dNi/EFs5jl+8ji5uGgxqANP3qHwW86n6gSCYjiawXYK2sgP8yjQiH7hlttZCfaCXfpr+ MeEuxDg5DXRDTRJG+zvdLZVSoPP6cFk5vO87dugHkx83CyEBP7s7V2XewS/mbqDTJDwk zTld8Mv93FzQxXtEsSWDGevDKbD/TCVUT5Q+8XZuzeyTdEBcPBauGybeJaWaxIbAVTe2 FlYA== 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=TkegV801ASP6OIM88f/HPamDvWOBYYOHqU4SJglDDJw=; b=u4WmrIA+mBVMgSLy5R8vV/vrIXksMj963sQFCt/PvE6DdMT1hTudmWJqtdnDTEDWwN s0u0jpC6OV3MEnVCbouTKlYsa8NEci8ZtXH9MKBEbZfKmShA0CQHGiRFCjbfevWhWIiZ J/JSDIGnuapdW1yCVP1BJ+iPWDGhT8+3JDIoxZiqXnxXlQzxVZ+MPMhkGo96G9OgzlZD O0B/iKHGyFfdMUERgFWs/Q5gtUF5yt3PBue8xAC7pQTHwBmEKDbMo9QvWCYUIa36RZ32 amkv4e0h2u4MmGOdo8F8Lp2FtU6HKCNp7nOR+MrbcRMG0riKWo4P4fYXWvvboiBo+TfG lCsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FWY4vLrW; 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 n19-20020aa7c453000000b004bfe6a447f9si9865064edr.186.2023.03.06.02.26.49; Mon, 06 Mar 2023 02:27:13 -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=FWY4vLrW; 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 S230310AbjCFKJ1 (ORCPT + 99 others); Mon, 6 Mar 2023 05:09:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbjCFKJU (ORCPT ); Mon, 6 Mar 2023 05:09:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41CB22001; 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 42D0E60DC1; Mon, 6 Mar 2023 10:09:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98A49C433A1; 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=oHtOiiLls+D/brpZp/GfYW0LOJJAvdIWo6VBajIFJFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FWY4vLrWgV44TRuLq2J4Mfxnhm4vWWeRrePKjiND/BjJ8pjdbtFYWkdbOY6u28fXF 5xSUDav0bMngErNyVJQ+EUR/6z0MUMlsJza97tywfH2jjIl4DMMQo/kKC0COBlsvzr n48eO7snFlpxYT9QcvifF2L3xPa2krIgZfprVnQSVoKfU2YRz8L4BVCR/SEy8YN/iq MCi98skpVAP2AJR4oj1k9b4zqai4ho+ID6Q2Ph0+411m7N2u2ESgJFKoMKkCO52Gcp wHJb6uzimOIeRgVzRn/ZJEt/p/e7CzZtjzu0i4QHtw++GBWcPYCWnb+XPp+Oj6z1gI LYvQOqHte8c6A== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ7n5-0007Qf-71; 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 Subject: [PATCH 03/10] drm/msm: fix NULL-deref on snapshot tear down Date: Mon, 6 Mar 2023 11:07:15 +0100 Message-Id: <20230306100722.28485-4-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?1759613743230338386?= X-GMAIL-MSGID: =?utf-8?q?1759613743230338386?= 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: 98659487b845 ("drm/msm: add support to take dpu snapshot") Cc: stable@vger.kernel.org # 5.14 Cc: Abhinav Kumar Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 9ded384acba4..17a59d73fe01 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -242,7 +242,8 @@ static int msm_drm_uninit(struct device *dev) msm_fbdev_free(ddev); #endif - msm_disp_snapshot_destroy(ddev); + if (kms) + msm_disp_snapshot_destroy(ddev); drm_mode_config_cleanup(ddev);