From patchwork Fri Sep 18 08:46:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7213791 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 682A5BEEC1 for ; Fri, 18 Sep 2015 08:47:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9565B20515 for ; Fri, 18 Sep 2015 08:47:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E3EA8208D6 for ; Fri, 18 Sep 2015 08:46:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA3686E4E7; Fri, 18 Sep 2015 01:46:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id B4AF06E4E7 for ; Fri, 18 Sep 2015 01:46:56 -0700 (PDT) Received: by pacfv12 with SMTP id fv12so46189534pac.2 for ; Fri, 18 Sep 2015 01:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=T+KD0ZY5jZ5Tr9umKcArG617UDF+NlyoeXJLzq3kWcA=; b=SAuO/N9oN8lcqP84RzAR8mt8SWC8KZBTeCKqSxv0LeaKzbpdd/ZNly+R587S5CYHkY 48I48U+a6qNU8OOd4b/ZwkiG/3rEJj1saU2WsKcC8KeKAqDFNtltruYgYrCujqD1U18F zIbz0e4V5ZfodAgdWTXPEF/hTeJF/JbUxw4sOBjlPS4sTXRHQNCwrYsfMHBKe/L8zWY7 Ix67x8FUkewUx0CCPnVxqQkw2NJQOvQRFwUb6D7DwmhBnvEx5dNYpu9P8Xy7MKSwD/nC l/Pwa0+ZkEQ+7Mi3INSG3bdK2A3xThCZBhg8h9d92JMyrC/wylWvweHIm+zvev46sxvN Xgjg== X-Received: by 10.66.157.72 with SMTP id wk8mr5860854pab.132.1442566016181; Fri, 18 Sep 2015 01:46:56 -0700 (PDT) Received: from localhost.localdomain ([49.206.249.64]) by smtp.gmail.com with ESMTPSA id bz4sm7666910pbd.6.2015.09.18.01.46.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Sep 2015 01:46:55 -0700 (PDT) From: Sudip Mukherjee To: David Airlie , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH] drm/amdgpu: fix memory leak Date: Fri, 18 Sep 2015 14:16:48 +0530 Message-Id: <1442566008-24649-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sudip Mukherjee X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 If amdgpu_ib_get() fails we returned the error code but we missed freeing ib. Signed-off-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index f68b7cd..0e61074 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -455,8 +455,10 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev, return -ENOMEM; r = amdgpu_ib_get(ring, NULL, ndw * 4, ib); - if (r) + if (r) { + kfree(ib); return r; + } ib->length_dw = 0; /* walk over the address space and update the page directory */