diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 | 
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 | 
| commit | 1ebbe2b20091d306453a5cf480a87e6cd28ae76f (patch) | |
| tree | f5cd7a0fa69b8b1938cb5a0faed2e7b0628072a5 /fs/sysfs/inode.c | |
| parent | ac58c9059da8886b5e8cde012a80266b18ca146e (diff) | |
| parent | 674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff) | |
Merge branch 'linus'
Diffstat (limited to 'fs/sysfs/inode.c')
| -rw-r--r-- | fs/sysfs/inode.c | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 689f7bcfaf3..4c29ac41ac3 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c @@ -54,11 +54,10 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)  	if (!sd_iattr) {  		/* setting attributes for the first time, allocate now */ -		sd_iattr = kmalloc(sizeof(struct iattr), GFP_KERNEL); +		sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL);  		if (!sd_iattr)  			return -ENOMEM;  		/* assign default attributes */ -		memset(sd_iattr, 0, sizeof(struct iattr));  		sd_iattr->ia_mode = sd->s_mode;  		sd_iattr->ia_uid = 0;  		sd_iattr->ia_gid = 0; @@ -227,12 +226,16 @@ void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)  void sysfs_hash_and_remove(struct dentry * dir, const char * name)  {  	struct sysfs_dirent * sd; -	struct sysfs_dirent * parent_sd = dir->d_fsdata; +	struct sysfs_dirent * parent_sd; + +	if (!dir) +		return;  	if (dir->d_inode == NULL)  		/* no inode means this hasn't been made visible yet */  		return; +	parent_sd = dir->d_fsdata;  	mutex_lock(&dir->d_inode->i_mutex);  	list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {  		if (!sd->s_element) | 
