From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755577AbZBWX0i (ORCPT ); Mon, 23 Feb 2009 18:26:38 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751632AbZBWX0a (ORCPT ); Mon, 23 Feb 2009 18:26:30 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:57462 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751525AbZBWX03 (ORCPT ); Mon, 23 Feb 2009 18:26:29 -0500 Date: Mon, 23 Feb 2009 15:25:55 -0800 From: Andrew Morton To: Krzysztof Sachanowicz Cc: linux-kernel@vger.kernel.org, marcin.pilipczuk@gmail.com, torvalds@linux-foundation.org, Alexey Dobriyan Subject: Re: [PATCH] proc: proc_get_inode should de_put when inode already initialized Message-Id: <20090223152555.a499b76a.akpm@linux-foundation.org> In-Reply-To: <200902232221.55714.analyzer1@gmail.com> References: <200902232221.55714.analyzer1@gmail.com> X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.20; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Feb 2009 22:21:55 +0100 Krzysztof Sachanowicz wrote: > de_get is called before every proc_get_inode, but corresponding de_put is > called only when dropping last reference to an inode. This might cause > something like > remove_proc_entry: /proc/stats busy, count=14496 > to be printed to the syslog. > > The fix is to call de_put in case of an already initialized inode in > proc_get_inode. > > Signed-off-by: Krzysztof Sachanowicz > Tested-by: Marcin Pilipczuk > --- > --- linux-2.6.29-rc6.orig/fs/proc/inode.c 2009-02-23 20:43:32.000000000 +0100 > +++ linux-2.6.29-rc6/fs/proc/inode.c 2009-02-23 20:46:37.000000000 +0100 > @@ -485,8 +485,10 @@ struct inode *proc_get_inode(struct supe > } > } > unlock_new_inode(inode); > - } else > + } else { > module_put(de->owner); > + de_put(de); > + } > return inode; > > out_ino: This code area looks quite different in linux-next, although the changes there are removing proc_dir_entry.owner altogether and aren't obviously targetted at fixing this bug. Also... It's unpleasing to have the de_get() inside the caller and the de_put() inside the callee - it is better to have them both happening at the same level. If it is the case that "de_get is called before every proc_get_inode", then perhaps that operation should simply be moved into proc_get_inode().