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:	Wed, 08 Aug 2007 09:32:20 -0600
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Tejun Heo <htejun@...il.com>
Cc:	Greg KH <greg@...ah.com>, linux-kernel@...r.kernel.org,
	satyam@...radead.org, cornelia.huck@...ibm.com,
	stern@...land.harvard.edu,
	Linux Containers <containers@...ts.osdl.org>, gregkh@...e.de
Subject: Re: [PATCH 17/25] sysfs: Rewrite rename in terms of sysfs dirents

Tejun Heo <htejun@...il.com> writes:

>>  int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
>>  {
>> -	struct sysfs_dirent *sd;
>> +	struct sysfs_dirent *sd = kobj->sd;
>>  	struct dentry *parent = NULL;
>>  	struct dentry *old_dentry = NULL, *new_dentry = NULL;
>>  	const char *dup_name = NULL;
>> @@ -863,42 +863,41 @@ int sysfs_rename_dir(struct kobject * kobj, const char
> *new_name)
>>  
>>  	mutex_lock(&sysfs_rename_mutex);
>>  
>> +	error = 0;
>> +	if (strcmp(sd->s_name, new_name) == 0)
>> +		goto out;	/* nothing to rename */
>> +
>>  	/* get the original dentry */
>>  	old_dentry = sysfs_get_dentry(sd);
>>  	if (IS_ERR(old_dentry)) {
>>  		error = PTR_ERR(old_dentry);
>> +		goto out;
>>  	}
>>  
>>  	parent = old_dentry->d_parent;
>>  
>>  	/* lock parent and get dentry for new name */
>>  	mutex_lock(&parent->d_inode->i_mutex);
>> +	mutex_lock(&sysfs_mutex);
>>  
>> +	error = -EEXIST;
>> +	if (sysfs_find_dirent(sd->s_parent, new_name))
>>  		goto out_unlock;
>>  
>> +	error = -ENOMEM;
>> +	new_dentry = d_alloc_name(parent, new_name);
>> +	if (!new_dentry)
>>  		goto out_unlock;
>>  
>>  	/* rename kobject and sysfs_dirent */
>>  	error = -ENOMEM;
>>  	new_name = dup_name = kstrdup(new_name, GFP_KERNEL);
>>  	if (!new_name)
>> +		goto out_unlock;
>>  
>>  	error = kobject_set_name(kobj, "%s", new_name);
>>  	if (error)
>> +		goto out_unlock;
>>  
>>  	mutex_lock(&sysfs_mutex);
>
> sysfs_mutex is being grabbed twice and unlocked twice later.

Ugh.  That patch was supposed to remove the inner grab and release of
sysfs_mutex.  I guess I somehow failed to move that change all of the
way down to this patch.  #18 gets it right for sysfs_move_dir.  And
#20 fixes it but yes this patch is broken, and will mess up any
git-bisect badly.

So this patch needs to be respun.

Eric

-
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