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] [day] [month] [year] [list]
Date:	Tue, 13 Jan 2015 13:33:24 +0800
From:	Jiang Liu <jiang.liu@...ux.intel.com>
To:	Al Viro <viro@...IV.linux.org.uk>
CC:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: namespace: Simplify function commit_tree()

On 2015/1/13 13:28, Al Viro wrote:
> On Tue, Jan 13, 2015 at 01:08:06PM +0800, Jiang Liu wrote:
>> Simplify function commit_tree() in fs/namespace.c, it also improves code
>> readability.
> 
> Huh?
> 
>>  static void commit_tree(struct mount *mnt, struct mount *shadows)
>>  {
>>  	struct mount *parent = mnt->mnt_parent;
>> -	struct mount *m;
>> -	LIST_HEAD(head);
>>  	struct mnt_namespace *n = parent->mnt_ns;
>>  
>>  	BUG_ON(parent == mnt);
>> -
>> -	list_add_tail(&head, &mnt->mnt_list);
>> -	list_for_each_entry(m, &head, mnt_list)
>> -		m->mnt_ns = n;
>> -
>> -	list_splice(&head, n->list.prev);
>> -
>> +	mnt->mnt_ns = n;
>> +	list_add_tail(&mnt->mnt_list, &n->list);
> 
> And who will set ->mnt_ns on other mounts reachable via ->mnt_list from mnt?
> Not to mention putting them on n->list...
> 
> What you seem to have missed is that list_add_tail(&head, &mnt->mnt_list)
> is not the same thing as list_add_tail(&mnt->mnt_list, &head).  We are
> not ripping mnt->mnt_list from whatever list it was on and insert it into
> a previously empty one in head.  We take an unanchored cyclic list (all
> elements being some_mnt->mnt_list) and anchor it at head, then go through
> all elements of the original list and move them all at once into the
> end of n->list.
Hi Al,
	Sorry for the noise, didn't realized that mnt->mnt_list anchors
a whole list:(
Regards!
Gerry
--
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