From patchwork Fri Sep 25 10:58:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 7263401 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AC7D09F380 for ; Fri, 25 Sep 2015 11:16:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1E7920ABA for ; Fri, 25 Sep 2015 11:16:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 04D7120AAF for ; Fri, 25 Sep 2015 11:16:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B14D6E068; Fri, 25 Sep 2015 04:16:30 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org X-Greylist: delayed 909 seconds by postgrey-1.34 at gabe; Fri, 25 Sep 2015 04:16:28 PDT Received: from m12-11.163.com (m12-11.163.com [220.181.12.11]) by gabe.freedesktop.org (Postfix) with ESMTP id 28C926E064; Fri, 25 Sep 2015 04:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=/ByDkEz3sQNyij2Dju nilG2AOseDt8E3dB2L5khdwVE=; b=lZxUlVqPMS1YT6xp+iOIawmSdiY8up66tb bXBrGIk6OpgNU0WrjHOb+FrkWeo3qpKB+oeSoovJtbmQ3OXhNrrpQGxXPrj1/FfE FD6QBjhYe4UZoR1BZiTjPvXZGAW3aMU4sW6YMWnU4HbZHNzKWpv5Mg43PZZwGqXX ida/gTIsE= Received: from localhost (unknown [218.17.162.133]) by smtp7 (Coremail) with SMTP id C8CowEAZ6UfGKAVWjhg+Cw--.268S3; Fri, 25 Sep 2015 18:58:16 +0800 (CST) From: Geliang Tang To: Daniel Vetter , Jani Nikula , David Airlie Date: Fri, 25 Sep 2015 03:58:11 -0700 Message-Id: <7789a9d65ac9f2fc27e95a40b6995b21aab9fb73.1443198651.git.geliangtang@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: C8CowEAZ6UfGKAVWjhg+Cw--.268S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF18GF48Zr4rZF48AF1DWrg_yoWDtrbEka yxArWxGrW2yF9Y9F12krnxZFW0yayY9Fs5X3Wrt3y5JFs7Gws5XrZFgF98X3yDGa18ZF98 X3WkZFn5JrnrKjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU1BHq3UUUUU== X-Originating-IP: [218.17.162.133] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbivwmAmVWBNRobVAAAsb Cc: Geliang Tang , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] drm/i915: fix task reference leak in i915_debugfs.c X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 Leak a task reference in i915_ppgtt_info(), add put_task_struct() to fix it. Signed-off-by: Geliang Tang --- drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 5615d3d..8797717 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2288,9 +2288,13 @@ static int i915_ppgtt_info(struct seq_file *m, void *data) list_for_each_entry_reverse(file, &dev->filelist, lhead) { struct drm_i915_file_private *file_priv = file->driver_priv; + struct task_struct *task; - seq_printf(m, "\nproc: %s\n", - get_pid_task(file->pid, PIDTYPE_PID)->comm); + task = get_pid_task(file->pid, PIDTYPE_PID); + if (!task) + return -ESRCH; + seq_printf(m, "\nproc: %s\n", task->comm); + put_task_struct(task); idr_for_each(&file_priv->context_idr, per_file_ctx, (void *)(unsigned long)m); }