Received: by 10.213.65.68 with SMTP id h4csp3841786imn; Tue, 10 Apr 2018 05:37:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/g0FFbXsIbp0BG4sXQETWmuhIZb4uTQldIzoNh7rdKEFWYRk4FmKAniskDOl2nRGLVsuNT X-Received: by 10.98.86.16 with SMTP id k16mr190755pfb.149.1523363864720; Tue, 10 Apr 2018 05:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363864; cv=none; d=google.com; s=arc-20160816; b=Oea1ltFhtRGTDVYg9ypHqJLrUN//3tiq6R3S1n9m9liFDYudG9jOYtwTJWsdGVFre+ 9HqVe3+j03fy9yHmt546LOfWt2ydGBHu7XO9d8UEzMeaB9vVf4Z9ISzGXGzTugqhFg/S 9l0+R7e5Elny+7MCKvJw7EAKFQfDhei/RqWtv8PWsOy934Nim9lpwhVsMFHH0ogQPIY6 V54DciO2EmEvlq3wYd+gUZZ04uT7m/sLhsKCFuwhs8n3jaz6/5IvYuVTOeWKz3LrmNKS jdhjCqQSVQRzBnkX4eqNPsgNViSpSGhkUYH1UoNTjWlGfIubMwDde7vlR9dGFZOma8wN 6sHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=Wo8bN6kKs2D5f9YsXMXYJtv4jzwyzAUNZJq1BF7hkAE=; b=lFvzGcnpaiHsSZeGn5vjbsFO4dHVXiRVh6UBO1uo0GguCKHV75TWi/eE77YZ8NIS2a HEi4LPWPPJg5OIsKXnvHbtrTDf+Kbv5tXPtRKhp+UCh1xZ7SmeAwSya1vZfn1NjfTGYL 4JoxoRsgN2R1GLZbxZcFKJiwfwyw+kH/Gs9k+QaKZKJbaGZAoAqFunmN9F7sHBItKH3f CG8isdnDDBuT6ZRamAPwtQro1fz9DKl/QmzjnH3PAPwpy+WlveYeYYSlwsXtNjesXuf6 RBizCbH9Gn0SGDGRvf7JzLzuBYkJPNM19k11wGRCQAUuKhd7n/wh2c6Tn5DYxIT0Mhg4 yfLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5-v6si326145plk.421.2018.04.10.05.37.07; Tue, 10 Apr 2018 05:37:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753291AbeDJMdY (ORCPT + 99 others); Tue, 10 Apr 2018 08:33:24 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:49251 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753203AbeDJMdV (ORCPT ); Tue, 10 Apr 2018 08:33:21 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1f5sSW-0003zX-Jf; Tue, 10 Apr 2018 12:33:12 +0000 From: Colin King To: Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/i915/gvt: fix memory leak of a cmd_entry struct on error exit path Date: Tue, 10 Apr 2018 13:33:12 +0100 Message-Id: <20180410123312.24631-1-colin.king@canonical.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King The error exit path when a duplicate is found does not kfree and cmd_entry struct and hence there is a small memory leak. Fix this by kfree'ing it. Detected by CoverityScan, CID#1370198 ("Resource Leak") Fixes: be1da7070aea ("drm/i915/gvt: vGPU command scanner") Signed-off-by: Colin Ian King --- drivers/gpu/drm/i915/gvt/cmd_parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c index d85939bd7b47..3b6d26c44e37 100644 --- a/drivers/gpu/drm/i915/gvt/cmd_parser.c +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c @@ -2864,6 +2864,7 @@ static int init_cmd_table(struct intel_gvt *gvt) if (info) { gvt_err("%s %s duplicated\n", e->info->name, info->name); + kfree(e); return -EEXIST; } -- 2.15.1