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: 4332231 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 91408BEEAA 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 B35D020295 for ; Tue, 10 Jun 2014 20:58:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF726201C0 for ; Tue, 10 Jun 2014 20:58:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753968AbaFJU60 (ORCPT ); Tue, 10 Jun 2014 16:58:26 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:56058 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753960AbaFJU6Z (ORCPT ); Tue, 10 Jun 2014 16:58:25 -0400 Received: by mail-wi0-f176.google.com with SMTP id n3so4221429wiv.15 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 Cc: linux-samsung-soc@vger.kernel.org, Inki Dae , David Airlie , Andrzej Hajda , Tomasz Figa 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 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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;