From patchwork Thu Jan 16 06:01:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 23251 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B24C220555 for ; Thu, 16 Jan 2014 06:05:58 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id e14sf9131154iej.4 for ; Wed, 15 Jan 2014 22:05:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=4TcedTptL8lTdF0eUmcof4rPRda8AjW4Mn6HmsVIHOA=; b=FibxGvnRrfJinRzL3SN7ki3xPcVNqALkNBiR+MTe5ypxkar/n2o8yAp2T3OcPGOtFL yD3OUqPWYRMsimomyAjK6GOPMKzLP4CrO5QuH6hUrFicKwftc1GKDt8oan+35Q4bNi8P DpRwWYA9/44pKg22xbN8ThFqEw7uzx97hlGgAVZtk4K3cjj9So2sX2/xEK0AyoIlr+af f3AuQLZ5Yx4xs+2/CyphOc6lNr1YRFbNeMI2O5XKooPeDjD5PCP/TZjjio4pPspvLBOm qmh1ZLn36tJcjEby/wGIXdjjXM8W9S/17Rvu/hZKuCQDT5sH6cVP62XCGKEq1H5Q2SUz Mwgw== X-Gm-Message-State: ALoCoQnIohoBzQ0mAG+tRqL8U/ajHbXbEpHqrayGqHGv5LYak+dVrr4LXEYmoMIWFlyWp+m+tNtC X-Received: by 10.50.18.49 with SMTP id t17mr2610541igd.3.1389852358043; Wed, 15 Jan 2014 22:05:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.52 with SMTP id j49ls105071qge.7.gmail; Wed, 15 Jan 2014 22:05:57 -0800 (PST) X-Received: by 10.58.6.239 with SMTP id e15mr5338330vea.14.1389852357933; Wed, 15 Jan 2014 22:05:57 -0800 (PST) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id eo4si2812577vdb.43.2014.01.15.22.05.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 22:05:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id cz12so798851veb.40 for ; Wed, 15 Jan 2014 22:05:57 -0800 (PST) X-Received: by 10.53.11.198 with SMTP id ek6mr741145vdd.24.1389852357861; Wed, 15 Jan 2014 22:05:57 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp324235ved; Wed, 15 Jan 2014 22:05:57 -0800 (PST) X-Received: by 10.66.222.234 with SMTP id qp10mr7806694pac.156.1389852356921; Wed, 15 Jan 2014 22:05:56 -0800 (PST) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by mx.google.com with ESMTPS id kn7si5998809pbc.66.2014.01.15.22.05.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 22:05:56 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.182 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.192.182; Received: by mail-pd0-f182.google.com with SMTP id v10so2145715pde.13 for ; Wed, 15 Jan 2014 22:05:56 -0800 (PST) X-Received: by 10.66.49.74 with SMTP id s10mr7927823pan.0.1389852356534; Wed, 15 Jan 2014 22:05:56 -0800 (PST) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id e6sm12369296pbg.4.2014.01.15.22.05.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 22:05:55 -0800 (PST) From: Sachin Kamat To: dri-devel@lists.freedesktop.org Cc: inki.dae@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH v2 1/1] drm/exynos: Fix freeing issues in exynos_drm_drv.c Date: Thu, 16 Jan 2014 11:31:26 +0530 Message-Id: <1389852086-11801-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sachin.kamat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Fixes the following errors: drivers/gpu/drm/exynos/exynos_drm_drv.c:182 exynos_drm_open() error: double free of 'file_priv' drivers/gpu/drm/exynos/exynos_drm_drv.c:188 exynos_drm_open() error: dereferencing freed memory 'file_priv' Signed-off-by: Sachin Kamat --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 9d096a0..215131a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -171,22 +171,24 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) file->driver_priv = file_priv; ret = exynos_drm_subdrv_open(dev, file); - if (ret) { - kfree(file_priv); - file->driver_priv = NULL; - } + if (ret) + goto out; anon_filp = anon_inode_getfile("exynos_gem", &exynos_drm_gem_fops, NULL, 0); if (IS_ERR(anon_filp)) { - kfree(file_priv); - return PTR_ERR(anon_filp); + ret = PTR_ERR(anon_filp); + goto out; } anon_filp->f_mode = FMODE_READ | FMODE_WRITE; file_priv->anon_filp = anon_filp; return ret; +out: + kfree(file_priv); + file->driver_priv = NULL; + return ret; } static void exynos_drm_preclose(struct drm_device *dev,