@@ -1049,23 +1049,30 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
if (!file)
goto out_fail;
+ retval = -EIO;
+ if (!file_hotplug_read_trylock(file))
+ goto fput_fail;
+
dentry = file->f_path.dentry;
retval = -ENOTDIR;
if (!S_ISDIR(dentry->d_inode->i_mode))
- goto fput_fail;
+ goto unlock_fail;
retval = file_permission(file, MAY_EXEC);
if (retval)
- goto fput_fail;
+ goto unlock_fail;
nd->path = file->f_path;
path_get(&file->f_path);
+ file_hotplug_read_unlock(file);
fput_light(file, fput_needed);
}
return 0;
+unlock_fail:
+ file_hotplug_read_unlock(file);
fput_fail:
fput_light(file, fput_needed);
out_fail: