From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH 20/25] sysfs: Rename Support multiple superblocks Date: Thu, 09 Aug 2007 01:42:03 +0900 Message-ID: <46B9F25B.6020804@gmail.com> References: <20070808093505.GL13674@htj.dyndns.org> <46B9E660.6030702@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: "Eric W. Biederman" Cc: Greg KH , linux-kernel@vger.kernel.org, satyam@infradead.org, cornelia.huck@de.ibm.com, stern@rowland.harvard.edu, Linux Containers , gregkh@suse.de List-Id: containers.vger.kernel.org Eric W. Biederman wrote: >> /* Find the first parent which has valid dentry. >> */ >> dentry = NULL; >> cur = sd; >> while (!(dentry = __sysfs_get_dentry(sb, cur))) { >> if (cur->s_flags & SYSFS_FLAG_REMOVED) { >> dentry = ERR_PTR(-ENOENT); >> break; >> } >> cur = cur->s_parent; >> } > > Here we depend on the fact that sysfs_root is pointed to > by sb->s_root so we know it will always have a dentry. Hmmm... dentry could be ERR_PTR(-ENOENT) here if the REMOVED flag test succeeded, right? >> /* from the found dentry, look up depth times */ >> while (dentry->d_fsdata != sd) { And then dereferenced. The REMOVED test should never succeed there, so we're probably in the clear but still the code looks a bit scary. -- tejun