From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753381Ab0DBSpr (ORCPT ); Fri, 2 Apr 2010 14:45:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52432 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752796Ab0DBSpj (ORCPT ); Fri, 2 Apr 2010 14:45:39 -0400 Date: Fri, 2 Apr 2010 20:43:49 +0200 From: Oleg Nesterov To: Linus Torvalds Cc: Andrew Morton , Alan Cox , Greg KH , Catalin Marinas , Tetsuo Handa , Linux Kernel Mailing List , Serge Hallyn , "Eric W. Biederman" , Sukadev Bhattiprolu , stable@kernel.org Subject: Re: [PATCH 1/1] tty: release_one_tty() forgets to put pids Message-ID: <20100402184349.GA32229@redhat.com> References: <201003272121.ADE39095.JLFHOOMtSVOFQF@I-love.SAKURA.ne.jp> <20100331151719.8a92b302.akpm@linux-foundation.org> <20100402160447.GA19920@redhat.com> <20100402160512.GB19920@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/02, Linus Torvalds wrote: > > On Fri, 2 Apr 2010, Oleg Nesterov wrote: > > > > release_one_tty(tty) can be called when tty still has a reference > > to pgrp/session. In this case we leak the pid. > > Hmm. Maybe we should have cleared this in tty_release() already. We > already do some of the session clearing there (but we clear the session in > the _tasks_ associated with the tty, not the tty session pointer). Yes, probably we can free them earlier. But I am very nervous about this change, I tried to defer put_pid() as much as possible, in case something else uses ->prgp/session before free_tty_struct(). Oleg.