Commit 63d5d4f1 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] _devfs_walk_path fix

From: Andrey Borzenkov <arvidjaar@mail.ru>

_devfs_walk_path does not check if de it is about to scan is a directory.
Next step is spinlock on non-spinlock memory.  It requires either artificial
setup or really broken driver but fairly easy to reproduce once you know how.

It is likely to exist in 2.4 as well.
parent f82c2338
...@@ -1224,6 +1224,12 @@ static devfs_handle_t _devfs_walk_path (struct devfs_entry *dir, ...@@ -1224,6 +1224,12 @@ static devfs_handle_t _devfs_walk_path (struct devfs_entry *dir,
{ {
struct devfs_entry *de, *link; struct devfs_entry *de, *link;
if (!S_ISDIR (dir->mode))
{
devfs_put (dir);
return NULL;
}
if ( ( de = _devfs_descend (dir, name, namelen, &next_pos) ) == NULL ) if ( ( de = _devfs_descend (dir, name, namelen, &next_pos) ) == NULL )
{ {
devfs_put (dir); devfs_put (dir);
......
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