Commit f82c2338 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] devfs_mk_dir fix

From: Andrey Borzenkov <arvidjaar@mail.ru>

devfs_mk_dir freed wrong de and incorrectly passed to devfsd already freed
de.  Besides it did not even check if entry found was actually directory.
parent 312e2e7b
...@@ -1697,13 +1697,13 @@ int devfs_mk_dir(const char *fmt, ...) ...@@ -1697,13 +1697,13 @@ int devfs_mk_dir(const char *fmt, ...)
} }
error = _devfs_append_entry(dir, de, &old); error = _devfs_append_entry(dir, de, &old);
if (error == -EEXIST) { if (error == -EEXIST && S_ISDIR(old->mode)) {
/* /*
* devfs_mk_dir() of an already-existing directory will * devfs_mk_dir() of an already-existing directory will
* return success. * return success.
*/ */
error = 0; error = 0;
devfs_put(old); goto out_put;
} else if (error) { } else if (error) {
PRINTK("(%s): could not append to dir: %p \"%s\"\n", PRINTK("(%s): could not append to dir: %p \"%s\"\n",
buf, dir, dir->name); buf, dir, dir->name);
......
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