Re: [PATCH 4/6] sysfs: use sysfs_lock to protect the sysfs_dirent tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cornelia Huck wrote:
> On Tue, 29 May 2007 01:36:27 +0900,
> Tejun Heo <[email protected]> wrote:
> 
>> @@ -795,6 +822,8 @@ static int sysfs_readdir(struct file * f
>>  			i++;
>>  			/* fallthrough */
>>  		default:
>> +			spin_lock(&sysfs_lock);
>> +
>>  			pos = &parent_sd->s_children;
>>  			while (*pos != cursor)
>>  				pos = &(*pos)->s_sibling;
>> @@ -827,6 +856,8 @@ static int sysfs_readdir(struct file * f
>>  			/* put cursor back in */
>>  			cursor->s_sibling = *pos;
>>  			*pos = cursor;
>> +
>> +			spin_unlock(&sysfs_lock);
>>  	}
>>  	return 0;
>>  }
> 
> Here's the cause of the "sleeping function called" I saw. filldir() is
> called under sysfs_lock, but calls copy_to_user()... This means you
> can't use sysfs_lock for protection here.

Ouch, right.  I think we can get away with a temp buffer there.  Thanks.

-- 
tejun
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux