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: 3841231 Return-Path: X-Original-To: patchwork-linux-arm@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 374A2BF540 for ; Mon, 17 Mar 2014 03:29:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51CB72018B for ; Mon, 17 Mar 2014 03:29:56 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6100520149 for ; Mon, 17 Mar 2014 03:29:55 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WPOEx-0003kD-6h; Mon, 17 Mar 2014 03:29:27 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WPOEl-00067l-00; Mon, 17 Mar 2014 03:29:15 +0000 Received: from mail-pd0-x230.google.com ([2607:f8b0:400e:c02::230]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WPOEi-00066d-PX for linux-arm-kernel@lists.infradead.org; Mon, 17 Mar 2014 03:29:13 +0000 Received: by mail-pd0-f176.google.com with SMTP id r10so4990302pdi.7 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=kf05qp52t3f1uWOQ725hu4LYbqFX2qVTnezm+kGeC2v5wc4gzZPw4kOs5Ajcd7LZ0C xLu1F6mf/Qetn2O4UyJfKlyQxNKV/7Eb5lM6dnzqL8+nM/S2wkaZAal4BH75RFJaWZtg XGOs6B1f3vShN1s0cktQknj4Svx2Ti1YE64OhBFdWrcmP39fgfwKsjH2qK+AkXexTajm hV8i8DHiuJAaykigT1Tbtj1aUdarJJjAcVfnbPaGGaSePmfXnb0UBvb9FxBEHVlzePBW ivJxqNzUIEhVtmVUeNcCD3Y9T67oH1tyfL/up32GVjO+Opfb1bDLsYuIxocGiqqjwsrR jD4A== X-Gm-Message-State: ALoCoQn5iJ/Mu9khnC9B6U0EMhXb+0TieBPXXj2T0ZNc33yZArBQqurzARvKocGVehqqNYKOE6C7 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140316_232912_910404_7F2DB97F X-CRM114-Status: GOOD ( 10.28 ) X-Spam-Score: -2.0 (--) Cc: Kukjin Kim , Joonyoung Shim , David Airlie , Seung-Woo Kim , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Kyungmin Park , linux-samsung-soc@vger.kernel.org, Daniel Kurtz , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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;