lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 9 Oct 2010 08:52:27 -0600
From:	Matthew Wilcox <matthew@....cx>
To:	Dave Chinner <david@...morbit.com>
Cc:	Christoph Hellwig <hch@...radead.org>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 14/18] fs: Protect inode->i_state with th einode->i_lock

On Fri, Oct 08, 2010 at 07:04:28PM +1100, Dave Chinner wrote:
> > > @@ -884,9 +897,9 @@ struct inode *new_inode(struct super_block *sb)
> > >  	inode = alloc_inode(sb);
> > >  	if (inode) {
> > >  		spin_lock(&inode_lock);
> > > -		__inode_add_to_lists(sb, NULL, inode);
> > >  		inode->i_ino = ++last_ino;
> > >  		inode->i_state = 0;
> > > +		__inode_add_to_lists(sb, NULL, inode);
> > >  		spin_unlock(&inode_lock);
> > >  	}
> > >  	return inode;
> > 
> > What's the point in doing this move?
> 
> hmmmm, let me think on that....
> 
> > 
> > > @@ -953,8 +966,8 @@ static struct inode *get_new_inode(struct super_block *sb,
> > >  			if (set(inode, data))
> > >  				goto set_failed;
> > >  
> > > -			__inode_add_to_lists(sb, b, inode);
> > >  			inode->i_state = I_NEW;
> > > +			__inode_add_to_lists(sb, b, inode);
> > 
> > Same here.
> 
> Ah, done thinking now! I was so the i_state field had been set
> before the inode was added to various lists and potentially
> accessable to other threads. I should probably add a comment to that
> effect, right?

If that can happen, don't we need a wmb() between the assignment to
i_state and the list_add too?  If so, that's a good comment :-)

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ