From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754272Ab0DBQH0 (ORCPT ); Fri, 2 Apr 2010 12:07:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42065 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751222Ab0DBQHR (ORCPT ); Fri, 2 Apr 2010 12:07:17 -0400 Date: Fri, 2 Apr 2010 18:05:12 +0200 From: Oleg Nesterov To: Andrew Morton , Alan Cox , Greg KH , Linus Torvalds Cc: Catalin Marinas , Tetsuo Handa , linux-kernel@vger.kernel.org, Serge Hallyn , "Eric W. Biederman" , Sukadev Bhattiprolu , stable@kernel.org Subject: [PATCH 1/1] tty: release_one_tty() forgets to put pids Message-ID: <20100402160512.GB19920@redhat.com> References: <201003272121.ADE39095.JLFHOOMtSVOFQF@I-love.SAKURA.ne.jp> <20100331151719.8a92b302.akpm@linux-foundation.org> <20100402160447.GA19920@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100402160447.GA19920@redhat.com> 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 release_one_tty(tty) can be called when tty still has a reference to pgrp/session. In this case we leak the pid. The patch needs the ack from someone who understand tty magic. Signed-off-by: Oleg Nesterov --- drivers/char/tty_io.c | 2 ++ 1 file changed, 2 insertions(+) --- TTT/drivers/char/tty_io.c~TTY_PID_LEAK 2010-03-17 16:00:59.000000000 +0100 +++ TTT/drivers/char/tty_io.c 2010-04-02 17:23:07.000000000 +0200 @@ -1423,6 +1423,8 @@ static void release_one_tty(struct work_ list_del_init(&tty->tty_files); file_list_unlock(); + put_pid(tty->pgrp); + put_pid(tty->session); free_tty_struct(tty); }