From patchwork Tue Jun 10 20:57:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 4332241 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BF85D9F357 for ; Tue, 10 Jun 2014 20:58:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0035E202BE for ; Tue, 10 Jun 2014 20:58:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1C14B20274 for ; Tue, 10 Jun 2014 20:58:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7987B6E0C0; Tue, 10 Jun 2014 13:58:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by gabe.freedesktop.org (Postfix) with ESMTP id AE0106E0C0 for ; Tue, 10 Jun 2014 13:58:24 -0700 (PDT) Received: by mail-wi0-f169.google.com with SMTP id hi2so4326475wib.4 for ; Tue, 10 Jun 2014 13:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=BZ6JjZWhD/dlAJrkQNqZexaK6uKSSz6M0hvvvRCIRWs=; b=A/IYvHlj8VmTxZvtIHdUvr7BXk21IAJfzCh4wimPT+wCyIZmV3pKL3MFLgztNB/0sA ZpAijUJVsQ8Lc0Vc8eJ2xXSfNuXWVQ8uXXMtfmTz8JI6Wc75Yv/YHr8NC65tCe2ZQHz2 RsrYqcF7jSvagYFCTAINcVjSJc8bYHt5/2nsmNYhpPsVrLMx2gRVu+KaTbSjMM4KJmR0 ySaZR2UOcaCyrQkmWlh/Ka8tkLG7/P1fRc7AKvuS3bBD2NvEg5Iv27MBxWk1k+FxuxVn J7ab2Y3uliAyCS1aZ2rW7EIkfxmgv1DbNH7fFj4j/LKS0CgR94lKWB7MycVHpTNP+b7d LFQg== X-Received: by 10.14.210.9 with SMTP id t9mr4885019eeo.6.1402433903619; Tue, 10 Jun 2014 13:58:23 -0700 (PDT) Received: from flatron.lan (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id a45sm54522777eez.2.2014.06.10.13.58.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Jun 2014 13:58:22 -0700 (PDT) From: Tomasz Figa To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/exynos: dpi: Fix NULL pointer dereference with legacy bindings Date: Tue, 10 Jun 2014 22:57:57 +0200 Message-Id: <1402433877-10867-1-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 2.0.0 Cc: linux-samsung-soc@vger.kernel.org, Andrzej Hajda X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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=-4.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 If there is no panel node in DT and instead display timings are provided directly in FIMD node, there is no panel object created and ctx->panel becomes NULL. However during Exynos DRM initialization drm_helper_hpd_irq_event() is called, which in turns calls exynos_dpi_detect(), which dereferences ctx->panel without a check, causing a NULL pointer derefrence. This patch fixes the issue by adding necessary NULL pointer check. Signed-off-by: Tomasz Figa Reviewed-by: Jingoo Han --- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index f1b8587..f44bd90 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c @@ -40,7 +40,7 @@ exynos_dpi_detect(struct drm_connector *connector, bool force) { struct exynos_dpi *ctx = connector_to_dpi(connector); - if (!ctx->panel->connector) + if (ctx->panel && !ctx->panel->connector) drm_panel_attach(ctx->panel, &ctx->connector); return connector_status_connected;