From patchwork Sun Sep 27 16:11:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 7273411 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B310C9F39B for ; Sun, 27 Sep 2015 16:35:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CFB842074A for ; Sun, 27 Sep 2015 16:35:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6BAF20717 for ; Sun, 27 Sep 2015 16:35:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750851AbbI0QfX (ORCPT ); Sun, 27 Sep 2015 12:35:23 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:51463 "EHLO mx0a-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbbI0QfW (ORCPT ); Sun, 27 Sep 2015 12:35:22 -0400 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id t8RGTltX006365; Sun, 27 Sep 2015 11:34:53 -0500 Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0a-001ae601.pphosted.com with ESMTP id 1x5rrx9d9w-1; Sun, 27 Sep 2015 11:34:53 -0500 Received: from EX12.ad.cirrus.com (unknown [172.19.9.182]) by mail1.cirrus.com (Postfix) with ESMTP id 0A29D3403A; Sun, 27 Sep 2015 11:35:11 -0500 (CDT) Received: from imbe.wolfsonmicro.main (172.20.9.178) by EX12.ad.cirrus.com (172.19.9.182) with Microsoft SMTP Server id 14.3.174.1; Sun, 27 Sep 2015 17:34:51 +0100 Received: from ck-lbox.wolfsonmicro.main ([172.22.20.70]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id t8RGYj2N030907; Sun, 27 Sep 2015 17:34:45 +0100 From: Charles Keepax To: , CC: , , , , , , , , Subject: [PATCH] drm/exynos: Avoid NULL pointer dereference in resume if bind failed Date: Sun, 27 Sep 2015 17:11:46 +0100 Message-ID: <1443370306-15429-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.7.2.5 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2015-09-27_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1509270277 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 If binding failed calling exynos_dp_enable in exynos_dp_resume will result in several NULL pointer dereferences. It is much better to simply skip suspend/resume handling if bind has failed, do so by checking if a drm_dev exists. Signed-off-by: Charles Keepax --- drivers/gpu/drm/exynos/exynos_dp_core.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index d66ade0..48baf07 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -1388,6 +1388,9 @@ static int exynos_dp_suspend(struct device *dev) { struct exynos_dp_device *dp = dev_get_drvdata(dev); + if (!dp->drm_dev) + return 0; + exynos_dp_disable(&dp->encoder); return 0; } @@ -1396,6 +1399,9 @@ static int exynos_dp_resume(struct device *dev) { struct exynos_dp_device *dp = dev_get_drvdata(dev); + if (!dp->drm_dev) + return 0; + exynos_dp_enable(&dp->encoder); return 0; }