Commit 00f2029a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] fix waitqueue leak in devfs_d_revalidate_wait

devfs_d_revalidate_wait adds to a waitqueue but never removes from it
again so we there's one entry full of reused stack space added on
each call (I wonder how this ever worked).

The function has a few more bugs (it effectivly does a sleep_on instead
of checking for the actual even and can't deal with negative dentries
at all), but I just had breakfast and don't want to poke into devfs
internals deeper - I still hope Adam's smalldevfs will get merged
anyway..
parent 2a73142f
......@@ -2336,6 +2336,8 @@ struct devfs_lookup_struct
wait_queue_head_t wait_queue;
};
/* XXX: this doesn't handle the case where we got a negative dentry
but a devfs entry has been registered in the meanwhile */
static int devfs_d_revalidate_wait (struct dentry *dentry, int flags)
{
struct inode *dir = dentry->d_parent->d_inode;
......@@ -2380,6 +2382,7 @@ static int devfs_d_revalidate_wait (struct dentry *dentry, int flags)
add_wait_queue (&lookup_info->wait_queue, &wait);
read_unlock (&parent->u.dir.lock);
schedule ();
remove_wait_queue (&lookup_info->wait_queue, &wait);
}
else read_unlock (&parent->u.dir.lock);
return 1;
......
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