mcctrl procfs: check entry was returned before using it
Change-Id: If66e95d217d1045e2e65bc5978bba020e3fa7c0d Refs: #1116
This commit is contained in:
committed by
Masamichi Takagi
parent
9b77630c8b
commit
09f663c246
@@ -294,6 +294,8 @@ get_base_entry(int osnum)
|
|||||||
if(!e){
|
if(!e){
|
||||||
e = add_procfs_entry(NULL, name, S_IFDIR | 0555,
|
e = add_procfs_entry(NULL, name, S_IFDIR | 0555,
|
||||||
uid, gid, NULL);
|
uid, gid, NULL);
|
||||||
|
if (!e)
|
||||||
|
return NULL;
|
||||||
e->osnum = osnum;
|
e->osnum = osnum;
|
||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
@@ -429,6 +431,8 @@ proc_exe_link(int osnum, int pid, const char *path)
|
|||||||
|
|
||||||
e = add_procfs_entry(parent, "exe", S_IFLNK | 0777, uid, gid,
|
e = add_procfs_entry(parent, "exe", S_IFLNK | 0777, uid, gid,
|
||||||
path);
|
path);
|
||||||
|
if (!e)
|
||||||
|
goto out;
|
||||||
e->data = kmalloc(strlen(path) + 1, GFP_KERNEL);
|
e->data = kmalloc(strlen(path) + 1, GFP_KERNEL);
|
||||||
strcpy(e->data, path);
|
strcpy(e->data, path);
|
||||||
task = find_procfs_entry(parent, "task");
|
task = find_procfs_entry(parent, "task");
|
||||||
@@ -437,6 +441,7 @@ proc_exe_link(int osnum, int pid, const char *path)
|
|||||||
uid, gid, path);
|
uid, gid, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
up(&procfs_file_list_lock);
|
up(&procfs_file_list_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user