mcexec_open_exec: make fput and add to mckernel_exec_files atomic
Change-Id: Iff4ac8bb9b4ebfcb9c77e84ed3f0a40e6b9efb6a
This commit is contained in:
@ -2001,26 +2001,31 @@ int mcexec_open_exec(ihk_os_t os, char * __user filename)
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
/* fget and list_add should be atomic */
|
||||
down(&mckernel_exec_file_lock);
|
||||
|
||||
file = open_exec(kfilename);
|
||||
retval = PTR_ERR(file);
|
||||
if (IS_ERR(file)) {
|
||||
up(&mckernel_exec_file_lock);
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
fullpath = d_path(&file->f_path, pathbuf, PATH_MAX);
|
||||
if (IS_ERR(fullpath)) {
|
||||
up(&mckernel_exec_file_lock);
|
||||
retval = PTR_ERR(fullpath);
|
||||
goto out_free;
|
||||
goto out_put_file;
|
||||
}
|
||||
|
||||
mcef = kmalloc(sizeof(*mcef), GFP_KERNEL);
|
||||
if (!mcef) {
|
||||
up(&mckernel_exec_file_lock);
|
||||
retval = -ENOMEM;
|
||||
goto out_put_file;
|
||||
}
|
||||
memset(mcef, 0, sizeof(struct mckernel_exec_file)); /* debug */
|
||||
|
||||
down(&mckernel_exec_file_lock);
|
||||
/* Find previous file (if exists) and drop it */
|
||||
list_for_each_entry(mcef_iter, &mckernel_exec_files, list) {
|
||||
if (mcef_iter->os == os && mcef_iter->pid == task_tgid_vnr(current)) {
|
||||
|
||||
Reference in New Issue
Block a user