From patchwork Mon Mar 17 03:28:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kurtz X-Patchwork-Id: 3841161 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 E1C189F373 for ; Mon, 17 Mar 2014 03:28:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24BDF201BC for ; Mon, 17 Mar 2014 03:28:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3634C2018B for ; Mon, 17 Mar 2014 03:28:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 59C0F6F6D0; Sun, 16 Mar 2014 20:28:20 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by gabe.freedesktop.org (Postfix) with ESMTP id 69DEA6F6D0 for ; Sun, 16 Mar 2014 20:28:19 -0700 (PDT) Received: by mail-pa0-f52.google.com with SMTP id rd3so5173166pab.11 for ; Sun, 16 Mar 2014 20:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=AaIlZJSGml8yDKftNtInI6NDxK/YW5YgyZpBhhU2aZU=; b=if5Za4AQ7FXRsxB9enXm8wiJ071ivzo5AKH3I3n/JPt7PvAx8QvwWtVWjTWAPdlDqu mEhK65VLha7Dbm/o88n6Hyuz93wBUJdU6MmHMxr6chta1495T2RHrP5daLv14cFMUeiC djvEyqprRSHYSIx5ySz+q4fX1wh311WJ69QYM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AaIlZJSGml8yDKftNtInI6NDxK/YW5YgyZpBhhU2aZU=; b=jskg9f5LB5KIoS2rEDjI6zMXpP5qI86upocKByTxxwy748bLXmNjMG7vMiAbWTGmex gJKrh1gxKTaF3xUzJUofh5UFXc4zF1mSs7tm5JPL6D5mJH70Qppd0xFrzQNxIAOebmbz jaRQlPEEIPqbWtnWDHiZhiNYIL4lZ7fZCLaGLuJ0eYEaVAehtcIOzZHyiTrA5WFiE1VM ttoHpBhPs+fwcFRUAhpFlAyiZjE6XQAJ24EtyPyZ9wOvhpbozXn8a6vowlm5Ccouxg/U opugT0Uc/8oxVWTJvJpWZCz/l8ZGtRsAGshClwb1C//VI/ERmlqNJcjeZLLg5XYIzE5G dKuA== X-Gm-Message-State: ALoCoQnLLRgeLPWCZsKtiYDOLym00NakeJw1C4p8X6G7QJeZm3smWPFPFczip4xgqHuzTxnPX48H X-Received: by 10.68.221.42 with SMTP id qb10mr23513941pbc.65.1395026899182; Sun, 16 Mar 2014 20:28:19 -0700 (PDT) Received: from djkurtz-z620.tpe.corp.google.com (djkurtz-z620.tpe.corp.google.com [172.30.210.61]) by mx.google.com with ESMTPSA id st4sm64861268pab.34.2014.03.16.20.28.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 16 Mar 2014 20:28:17 -0700 (PDT) From: Daniel Kurtz To: Inki Dae , Sachin Kamat Subject: [PATCH] drm/exynos: Fix (more) freeing issues in exynos_drm_drv.c Date: Mon, 17 Mar 2014 11:28:06 +0800 Message-Id: <1395026886-14325-1-git-send-email-djkurtz@chromium.org> X-Mailer: git-send-email 1.9.0.279.gdc9e3eb Cc: Kukjin Kim , Seung-Woo Kim , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Kyungmin Park , linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 The following commit [0] fixed a use-after-free, but left the subdrv open in the error path. [0] commit 6ca605f7c70895a35737435f17ae9cc5e36f1466 drm/exynos: Fix freeing issues in exynos_drm_drv.c Change-Id: I452e944bf090fb11434d9e34213c890c41c15d73 Signed-off-by: Daniel Kurtz --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 215131a..c204b4e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -172,20 +172,24 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) ret = exynos_drm_subdrv_open(dev, file); if (ret) - goto out; + goto err_file_priv_free; anon_filp = anon_inode_getfile("exynos_gem", &exynos_drm_gem_fops, NULL, 0); if (IS_ERR(anon_filp)) { ret = PTR_ERR(anon_filp); - goto out; + goto err_subdrv_close; } anon_filp->f_mode = FMODE_READ | FMODE_WRITE; file_priv->anon_filp = anon_filp; return ret; -out: + +err_subdrv_close: + exynos_drm_subdrv_close(dev, file); + +err_file_priv_free: kfree(file_priv); file->driver_priv = NULL; return ret;