* @EEXIST: A requested domain, bus or endpoint with the same
* name already exists. A specific data type, which is
* only expected once, is provided multiple times.
- * @EFAULT: The supplied memory could not be accessed, or the data
- * is not properly aligned.
+ * @EFAULT: The supplied memory could not be accessed, the data
+ * is not properly aligned, or the current task's memory
+ * is inaccessible.
* @EINVAL: The provided data does not match its type or other
* expectations, like a string which is not NUL terminated,
* or a string length that points behind the first
size_t len;
char *tmp;
- if (mm) {
- down_read(&mm->mmap_sem);
- if (mm->exe_file) {
- path_get(&mm->exe_file->f_path);
- exe_path = &mm->exe_file->f_path;
- }
- up_read(&mm->mmap_sem);
+ if (!mm)
+ return -EFAULT;
+
+ down_read(&mm->mmap_sem);
+ if (mm->exe_file) {
+ path_get(&mm->exe_file->f_path);
+ exe_path = &mm->exe_file->f_path;
}
+ up_read(&mm->mmap_sem);
if (!exe_path)
goto exit_mmput;
return -ENOMEM;
mm = get_task_mm(current);
- if (!mm)
+ if (!mm) {
+ ret = -EFAULT;
goto exit_free_page;
+ }
if (!mm->arg_end)
goto exit_mmput;