From patchwork Wed Dec 18 06:58:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 3374431 Return-Path: X-Original-To: patchwork-dri-devel@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 603FB9F314 for ; Thu, 19 Dec 2013 00:23:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EABF820604 for ; Thu, 19 Dec 2013 00:23:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5ED60204E7 for ; Thu, 19 Dec 2013 00:22:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CD4A105FBB; Wed, 18 Dec 2013 16:22:52 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 1916211D8A9 for ; Tue, 17 Dec 2013 22:58:24 -0800 (PST) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 17 Dec 2013 22:58:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,506,1384329600"; d="scan'208";a="328666883" Received: from gerry-dev.bj.intel.com ([10.238.158.74]) by AZSMGA002.ch.intel.com with ESMTP; 17 Dec 2013 22:58:19 -0800 From: Jiang Liu To: "Rafael J . Wysocki" , Bjorn Helgaas , Lv Zheng , Len Brown , Leonidas Da Silva Barbosa , Ashley Lai , Peter Huewe , Rajiv Andrade , Marcel Selhorst , Sirrix AG , Daniel Vetter , David Airlie , Jiri Kosina , Jiang Liu , Dave Airlie , Zhang Rui , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [RFC Patch v1 12/13] nouveau: fix memory leak in ACPI _DSM related code Date: Wed, 18 Dec 2013 14:58:20 +0800 Message-Id: <1387349901-3391-13-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com> References: <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com> X-Mailman-Approved-At: Wed, 18 Dec 2013 16:22:51 -0800 Cc: Tony Luck X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Fix memory leak in function nouveau_optimus_dsm() and nouveau_dsm(). Signed-off-by: Jiang Liu --- drivers/gpu/drm/nouveau/nouveau_acpi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 95c7404..03d4911 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c @@ -110,6 +110,7 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t * if (obj->type == ACPI_TYPE_INTEGER) if (obj->integer.value == 0x80000002) { + kfree(output.pointer); return -ENODEV; } @@ -156,8 +157,10 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg, uint32_t *result) obj = (union acpi_object *)output.pointer; if (obj->type == ACPI_TYPE_INTEGER) - if (obj->integer.value == 0x80000002) + if (obj->integer.value == 0x80000002) { + kfree(output.pointer); return -ENODEV; + } if (obj->type == ACPI_TYPE_BUFFER) { if (obj->buffer.length == 4 && result) {