From patchwork Mon Mar 17 03:28:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kurtz X-Patchwork-Id: 3841191 Return-Path: X-Original-To: patchwork-dri-devel@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 82CDABF540 for ; Mon, 17 Mar 2014 03:28:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EB11201BB for ; Mon, 17 Mar 2014 03:28:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CDD732018B for ; Mon, 17 Mar 2014 03:28:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D1566F996; Sun, 16 Mar 2014 20:28:53 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by gabe.freedesktop.org (Postfix) with ESMTP id 5379E6F996 for ; Sun, 16 Mar 2014 20:28:52 -0700 (PDT) Received: by mail-pd0-f170.google.com with SMTP id v10so5019971pde.15 for ; Sun, 16 Mar 2014 20:28:51 -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=0rJbkxBTZPRoDJE6inutB7jQSGwWZxIFiVxSkZsKn6Q=; b=C75ZfkRDfVpikZX5Ft9xfXJs7nQayODgFtP7dnX0U9v7hh8D0NPCnMqCdp68nwV2WL XFVLvGD74e33lrdzf4C1JWYzbccw71NEvfkTwt7XzAMeyGysyBA/bBdViaIDqUMOUNAG 4k0PYy3slTqTAbz7lDF6tqzZvW5H8umFog6Uc= 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=0rJbkxBTZPRoDJE6inutB7jQSGwWZxIFiVxSkZsKn6Q=; b=Rh7IfRa5i2ib3CQeV280oXn5e/tHv4iKFlXVjcHF8FZyO0k0jeHWLg0icC0n/Qvm1O EzwtY5XE9lRSetcf0ZTXhLNLN9PhMH5o7vvFxCTQwhXduYiCYGlE8eUPdTsLQKL9MesS Ord9okdgdhenX2l4WG8QpwdIxW/RuXegsmQgUlJ/U1wjrA0jXJHp4W7V+5ygN2q3dOZf lTcrJbr4+4KlDFHH3qi2kJwY2oAMUAbxsWIxBYgzvczqICS+GyHB2bcKwx5ESrc8duqq v5s0iLw6bXEhkNTbcJH8xlrljjhdn9vGIp8BPnNoC/zkrntq3yUwr/AHXVwJurslUwBq xFGA== X-Gm-Message-State: ALoCoQlk6eJk0LUdYRykmG1/oFqkv6dzLPIBlisDnxlq3D92klXCg8o3MG/4/5XKYOcCdTemCwTJ X-Received: by 10.68.239.137 with SMTP id vs9mr24094126pbc.84.1395026931162; Sun, 16 Mar 2014 20:28:51 -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 pp5sm38748555pbb.33.2014.03.16.20.28.47 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 16 Mar 2014 20:28:50 -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:39 +0800 Message-Id: <1395026919-14467-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=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 Signed-off-by: Daniel Kurtz Acked-by: Sachin Kamat --- Hi, I noticed this when reviewing some recent patches. I am only able to compile test this patch. 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;