From patchwork Wed Sep 25 04:46:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Navid Emamdoost X-Patchwork-Id: 11160143 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C3961709 for ; Wed, 25 Sep 2019 07:20:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24CB4222C8 for ; Wed, 25 Sep 2019 07:20:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24CB4222C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 811C86EB47; Wed, 25 Sep 2019 07:19:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 50EA56E832 for ; Wed, 25 Sep 2019 04:46:40 +0000 (UTC) Received: by mail-io1-xd43.google.com with SMTP id n197so10229620iod.9 for ; Tue, 24 Sep 2019 21:46:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=L0m69X+LQ4frLVby8EeJS1EQVq3OI3wT8S733h98iBY=; b=QaUVCwvP4tT4Pi5b9mcQX3E4GAk0evFYlo/TeU5pznDQHj3N9dF+A0CYpMgK5yYWtS ey94NXvf+jjWBCWy0sXZmc9S8oMyb9Kj93HP5CXFMhzdcjfgIWEluXhU8hWJlNevpIP7 xtPZuXHXdZ8UVYxe4OM3xrH4tVC0It8HxtHL9lCNh1SQA7DtC7H8jnNxfaVYzYQR5T9e VdXfyNw7b/3Nnn2ZCGsLbPx59rzGnnUeXcsEaKqM0Kyi2mF+vJbk/jgUxCLuIZuJbMiE lU4gchmONq9u/HSk9PshmQFXEMcaSHpaew0MVMDja5y/Xp6uKRoXiQDSEwgGKoHphmxO On6A== X-Gm-Message-State: APjAAAVcx8GFuDGhKFKvvt2zFswMmcJAEI319aj7GsWG/jK5460Ob6eA UXXlNbn0Oo91T7W08ypdgoc= X-Google-Smtp-Source: APXvYqyKT3ovdvw1fI5/3vLGvl5AkjEDbTc6sYb0NhOsx0Hd+zOXARsy+Js8tagkLvrb+17Hr4LvtA== X-Received: by 2002:a6b:210:: with SMTP id 16mr8335610ioc.104.1569386799583; Tue, 24 Sep 2019 21:46:39 -0700 (PDT) Received: from cs-dulles.cs.umn.edu (cs-dulles.cs.umn.edu. [128.101.35.54]) by smtp.googlemail.com with ESMTPSA id t4sm42107iln.82.2019.09.24.21.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 21:46:39 -0700 (PDT) From: Navid Emamdoost To: Subject: [PATCH] drm/vmwgfx: prevent memory leak in vmw_context_define Date: Tue, 24 Sep 2019 23:46:26 -0500 Message-Id: <20190925044627.2476-1-navid.emamdoost@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Wed, 25 Sep 2019 07:19:29 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=L0m69X+LQ4frLVby8EeJS1EQVq3OI3wT8S733h98iBY=; b=abELyR7FeIlVGJPkjZn9UpCopVU8AQ5F05bm6IeSz1xSMYAXnSpiotzDBDceHJQPEW ULcSyUQ7JjYrkFgsySjVXZcGtRWhTZi1aSQ9Lv+TYLvHvFI5wZrevpNyDbWkWtBZDBDq kKcg9WddnobR24uaUfYlf3VjfzCiE4OcUYEocPl20BWzTkNFGZYQ6fYcBVFpQTFK3gdi e1hH8VDbBkG6fXLNpGPTfgwpU35GBB+OHcEHKjhFe9nS5cYteJLubBJIl7ucnW0mji5y xUoDIRLmcuvwceWv2iZx3Afo9OD9T70H7d5GQ0mU0Hq2LhZnprpFf3nkzU1rEFzB3jQy cpnw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstrom , David Airlie , kjlu@umn.edu, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, emamd001@umn.edu, VMware Graphics , smccaman@umn.edu, Navid Emamdoost MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In vmw_context_define if vmw_context_init fails the allocated resource should be unreferenced. The goto label was fixed. Signed-off-by: Navid Emamdoost --- drivers/gpu/drm/vmwgfx/vmwgfx_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c index a56c9d802382..ac42f8a6acf0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c @@ -773,7 +773,7 @@ static int vmw_context_define(struct drm_device *dev, void *data, ret = vmw_context_init(dev_priv, res, vmw_user_context_free, dx); if (unlikely(ret != 0)) - goto out_unlock; + goto out_err; tmp = vmw_resource_reference(&ctx->res); ret = ttm_base_object_init(tfile, &ctx->base, false, VMW_RES_CONTEXT,