|
@@ -519,7 +519,14 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, s
|
|
|
*/
|
|
|
result = d_lookup(parent, name);
|
|
|
if (!result) {
|
|
|
- struct dentry * dentry = d_alloc(parent, name);
|
|
|
+ struct dentry *dentry;
|
|
|
+
|
|
|
+ /* Don't create child dentry for a dead directory. */
|
|
|
+ result = ERR_PTR(-ENOENT);
|
|
|
+ if (IS_DEADDIR(dir))
|
|
|
+ goto out_unlock;
|
|
|
+
|
|
|
+ dentry = d_alloc(parent, name);
|
|
|
result = ERR_PTR(-ENOMEM);
|
|
|
if (dentry) {
|
|
|
result = dir->i_op->lookup(dir, dentry, nd);
|
|
@@ -528,6 +535,7 @@ static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, s
|
|
|
else
|
|
|
result = dentry;
|
|
|
}
|
|
|
+out_unlock:
|
|
|
mutex_unlock(&dir->i_mutex);
|
|
|
return result;
|
|
|
}
|
|
@@ -1317,7 +1325,14 @@ static struct dentry *__lookup_hash(struct qstr *name,
|
|
|
|
|
|
dentry = cached_lookup(base, name, nd);
|
|
|
if (!dentry) {
|
|
|
- struct dentry *new = d_alloc(base, name);
|
|
|
+ struct dentry *new;
|
|
|
+
|
|
|
+ /* Don't create child dentry for a dead directory. */
|
|
|
+ dentry = ERR_PTR(-ENOENT);
|
|
|
+ if (IS_DEADDIR(inode))
|
|
|
+ goto out;
|
|
|
+
|
|
|
+ new = d_alloc(base, name);
|
|
|
dentry = ERR_PTR(-ENOMEM);
|
|
|
if (!new)
|
|
|
goto out;
|