Commit 6af705cb authored by Patrick Mochel's avatar Patrick Mochel

Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin

into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-core
parents 72574bb3 f81ab470
...@@ -50,6 +50,10 @@ read(struct file * file, char * userbuf, size_t count, loff_t * off) ...@@ -50,6 +50,10 @@ read(struct file * file, char * userbuf, size_t count, loff_t * off)
ret = count; ret = count;
} }
Done: Done:
if (buffer && buffer->data) {
kfree(buffer->data);
buffer->data = NULL;
}
return ret; return ret;
} }
...@@ -66,7 +70,7 @@ int alloc_buf_data(struct sysfs_bin_buffer * buffer) ...@@ -66,7 +70,7 @@ int alloc_buf_data(struct sysfs_bin_buffer * buffer)
static int fill_write(struct file * file, const char * userbuf, static int fill_write(struct file * file, const char * userbuf,
struct sysfs_bin_buffer * buffer) struct sysfs_bin_buffer * buffer)
{ {
return copy_from_user(buffer,userbuf,buffer->count) ? return copy_from_user(buffer->data,userbuf,buffer->count) ?
-EFAULT : 0; -EFAULT : 0;
} }
......
...@@ -71,7 +71,7 @@ int sysfs_create_dir(struct kobject * kobj) ...@@ -71,7 +71,7 @@ int sysfs_create_dir(struct kobject * kobj)
void sysfs_remove_dir(struct kobject * kobj) void sysfs_remove_dir(struct kobject * kobj)
{ {
struct list_head * node, * next; struct list_head * node;
struct dentry * dentry = dget(kobj->dentry); struct dentry * dentry = dget(kobj->dentry);
struct dentry * parent; struct dentry * parent;
...@@ -83,31 +83,28 @@ void sysfs_remove_dir(struct kobject * kobj) ...@@ -83,31 +83,28 @@ void sysfs_remove_dir(struct kobject * kobj)
down(&parent->d_inode->i_sem); down(&parent->d_inode->i_sem);
down(&dentry->d_inode->i_sem); down(&dentry->d_inode->i_sem);
list_for_each_safe(node,next,&dentry->d_subdirs) { spin_lock(&dcache_lock);
struct dentry * d = dget(list_entry(node,struct dentry,d_child)); node = dentry->d_subdirs.next;
/** while (node != &dentry->d_subdirs) {
* Make sure dentry is still there struct dentry * d = list_entry(node,struct dentry,d_child);
*/ list_del_init(node);
pr_debug(" o %s: ",d->d_name.name);
if (d->d_inode) {
pr_debug(" o %s (%d): ",d->d_name.name,atomic_read(&d->d_count));
if (d->d_inode) {
d = dget_locked(d);
pr_debug("removing"); pr_debug("removing");
/** /**
* Unlink and unhash. * Unlink and unhash.
*/ */
simple_unlink(dentry->d_inode,d); spin_unlock(&dcache_lock);
d_delete(d); d_delete(d);
simple_unlink(dentry->d_inode,d);
/**
* Drop reference from initial sysfs_get_dentry().
*/
dput(d); dput(d);
spin_lock(&dcache_lock);
} }
pr_debug(" done (%d)\n",atomic_read(&d->d_count)); pr_debug(" done\n");
/** node = dentry->d_subdirs.next;
* drop reference from dget() above.
*/
dput(d);
} }
up(&dentry->d_inode->i_sem); up(&dentry->d_inode->i_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment