From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756181AbbIYMY7 (ORCPT ); Fri, 25 Sep 2015 08:24:59 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:36428 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755960AbbIYMY5 (ORCPT ); Fri, 25 Sep 2015 08:24:57 -0400 Date: Fri, 25 Sep 2015 14:27:50 +0200 From: Daniel Vetter To: Jani Nikula Cc: Geliang Tang , Daniel Vetter , David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm/i915: fix task reference leak in i915_debugfs.c Message-ID: <20150925122750.GC3383@phenom.ffwll.local> Mail-Followup-To: Jani Nikula , Geliang Tang , Daniel Vetter , David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <7789a9d65ac9f2fc27e95a40b6995b21aab9fb73.1443198651.git.geliangtang@163.com> <87k2ren408.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k2ren408.fsf@intel.com> X-Operating-System: Linux phenom 4.1.0-2-amd64 User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2015 at 02:16:07PM +0300, Jani Nikula wrote: > On Fri, 25 Sep 2015, Geliang Tang wrote: > > Leak a task reference in i915_ppgtt_info(), add put_task_struct() > > to fix it. > > Introduced by > > commit 1c60fef535d143860d5bf6593e24ab6417f5227c > Author: Ben Widawsky > Date: Fri Dec 6 14:11:30 2013 -0800 > > drm/i915: Dump all ppgtt Queued for -next, thanks for the patch. -Daniel > > > > > > 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); > > } > > -- > > 1.9.1 > > > > > > -- > Jani Nikula, Intel Open Source Technology Center > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch