From patchwork Thu Nov 13 07:50:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 5294191 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7C9F7C11AD for ; Thu, 13 Nov 2014 07:50:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A954E201EF for ; Thu, 13 Nov 2014 07:50:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CF206201E4 for ; Thu, 13 Nov 2014 07:50:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2BFC76E9EB; Wed, 12 Nov 2014 23:50:23 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 46BA86E9EA for ; Wed, 12 Nov 2014 23:50:21 -0800 (PST) Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NEY003FXWFO57B0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 13 Nov 2014 16:50:12 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.115]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id E3.4F.17016.4B264645; Thu, 13 Nov 2014 16:50:12 +0900 (KST) X-AuditID: cbfee68d-f79296d000004278-7b-546462b4abc0 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 3A.98.20081.3B264645; Thu, 13 Nov 2014 16:50:12 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.252.83.67]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NEY009Z8WFMJBB0@mmp1.samsung.com>; Thu, 13 Nov 2014 16:50:11 +0900 (KST) From: Inki Dae To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/2] drm/exynos: fix null pointer dereference issue Date: Thu, 13 Nov 2014 16:50:08 +0900 Message-id: <1415865009-15979-2-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1415865009-15979-1-git-send-email-inki.dae@samsung.com> References: <1415865009-15979-1-git-send-email-inki.dae@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsWyRsSkWHdLUkqIweTLXBa31p1jteg9d5LJ 4srX92wWk+5PYLGYcX4fkwOrx/ZvD1g97ncfZ/Lo27KK0ePzJrkAligum5TUnMyy1CJ9uwSu jLk3W9gLtolU3Nn6jqWBcaZgFyMnh4SAicSNB/NZIGwxiQv31rN1MXJxCAksZZT417OOCaZo +fFTzBCJRYwSp5b0skI43UwSHz/cYASpYhNQlZi44j4biC0ioCzxd+IqsDizQL7E9XtnWUFs YQFniS3ztoOtYwGqP7fmFVg9r4CLxI9194HiHEDbFCTmTLIBCXMKuEp0HL3DDmILAZWcbFsN dp2EQDO7xIwJi9gg5ghIfJt8CKpXVmLTAWaIoyUlDq64wTKBUXgBI8MqRtHUguSC4qT0IkO9 4sTc4tK8dL3k/NxNjMBAPv3vWe8OxtsHrA8xCnAwKvHwvmBJCRFiTSwrrsw9xGgKtGEis5Ro cj4wXvJK4g2NzYwsTE1MjY3MLc2UxHkVpX4GCwmkJ5akZqemFqQWxReV5qQWH2Jk4uCUamCc uEG1aseetM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TR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: a.hajda@samsung.com, linux-samsung-soc@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes null pointer dereference issue incurred when ipp driver is enabled and Exynos drm driver is closed. Non kms driver should register its own sub driver to setup necessary resources, which is done by load(). So null pointer dereference occurs when ipp driver is enabled and Exynos drm driver is closed because ipp core device is registered after component_master_add_with_match call. This patch makes exynos_drm_device_subdrv_probe() to be called after all non kms drivers are registered. Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index e5c4c6c..f0bcdc6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -108,11 +108,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) if (ret) goto err_unbind_all; - /* Probe non kms sub drivers and virtual display driver. */ - ret = exynos_drm_device_subdrv_probe(dev); - if (ret) - goto err_cleanup_vblank; - /* * enable drm irq mode. * - with irq_enabled = true, we can use the vblank feature. @@ -138,8 +133,6 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) return 0; -err_cleanup_vblank: - drm_vblank_cleanup(dev); err_unbind_all: component_unbind_all(dev->dev, dev); err_mode_config_cleanup: @@ -153,8 +146,6 @@ err_free_private: static int exynos_drm_unload(struct drm_device *dev) { - exynos_drm_device_subdrv_remove(dev); - exynos_drm_fbdev_fini(dev); drm_kms_helper_poll_fini(dev); @@ -636,9 +627,16 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) goto err_unregister_ipp_drv; #endif + /* Probe non kms sub drivers and virtual display driver. */ + ret = exynos_drm_device_subdrv_probe(platform_get_drvdata(pdev)); + if (ret) + goto err_unregister_resources; + return ret; +err_unregister_resources: #ifdef CONFIG_DRM_EXYNOS_IPP + exynos_platform_device_ipp_unregister(); err_unregister_ipp_drv: platform_driver_unregister(&ipp_driver); err_unregister_gsc_drv: @@ -691,6 +689,8 @@ err_unregister_fimd_drv: static int exynos_drm_platform_remove(struct platform_device *pdev) { + exynos_drm_device_subdrv_remove(platform_get_drvdata(pdev)); + #ifdef CONFIG_DRM_EXYNOS_IPP exynos_platform_device_ipp_unregister(); platform_driver_unregister(&ipp_driver);