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: 3841171 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7AD099F3FF for ; Mon, 17 Mar 2014 03:28:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9C111201C0 for ; Mon, 17 Mar 2014 03:28:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AEAA1201BB for ; Mon, 17 Mar 2014 03:28:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932312AbaCQD2U (ORCPT ); Sun, 16 Mar 2014 23:28:20 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:51597 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932276AbaCQD2T (ORCPT ); Sun, 16 Mar 2014 23:28:19 -0400 Received: by mail-pd0-f180.google.com with SMTP id v10so5019565pde.39 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=X3J7QlEr7G/YlDU9yxWHWuKNIp7EhOFgCQmn/LKATKbH1ax7lSq19Ph8z2eOHB1akk uVr58TOt8Y+FfdwreQRqHGMjC/OO/kAjfcLyEUdE4VIGI6k5kl+SypjdODowEJrN8JfU syi+1HXcJx3JcbR9OycxzOaKYOUcn+B5aFcx85PNhXxljvE9NNANQ/7OKSpUgK9Xt/FJ XPEN9HHJtXWDpePrzCjN7nSIJcDUohEjWSEo1R7H2Zso9KMyIEo4Eph+ID7iWWbtMjss gbh+juAafGjPVDF9F+cZ9q0TFmHb0FJcjdkB7gb8Mq58uo9MukTLbhIy5brWnn+isPNN pcGA== X-Gm-Message-State: ALoCoQlWPgL116Bi2NDq4vjoVmgOuvZA+KR1JJUBNdHM316q+EnK77x/5hibZn6b7yXbCwDgfVRo 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 Cc: Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Kukjin Kim , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Kurtz 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 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 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;