From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753506Ab0DBSuQ (ORCPT ); Fri, 2 Apr 2010 14:50:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:23772 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752333Ab0DBSuK (ORCPT ); Fri, 2 Apr 2010 14:50:10 -0400 Date: Fri, 2 Apr 2010 20:48:23 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: Linus Torvalds , Andrew Morton , Alan Cox , Greg KH , Catalin Marinas , Tetsuo Handa , Linux Kernel Mailing List , Serge Hallyn , Sukadev Bhattiprolu , stable@kernel.org Subject: Re: [PATCH 1/1] tty: release_one_tty() forgets to put pids Message-ID: <20100402184823.GB32229@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, Eric W. Biederman wrote: > > My general paranoia would suggest setting the pids to NULL. So that > we don't have the chance of a use after free. In this case, I don't think this is needed. We are doing free_tty_struct()->kfree(tty) right after put_pid()s, nobody can use these pointers or we have another bug. Most probably this patch is correct (but perhaps it is not the best fix). Every time tty does put_pid() it should also clear the pointer. But I am not sure I grepped enough. Oleg.