[FIX] Prevent Issues 76/53976/1
authorHyeongsik Min <hyeongsik.min@samsung.com>
Thu, 10 Dec 2015 13:15:56 +0000 (22:15 +0900)
committerHyeongsik Min <hyeongsik.min@samsung.com>
Thu, 10 Dec 2015 13:15:56 +0000 (22:15 +0900)
452538 RESOURCE_LEAK bin_list_read
489424 NULL_RETURNS sspt_file_add_ip
489426 NULL_RETURNS preload_us_entry
489427 RESOURCE_LEAK create_lig_inst_data
489428 RESOURCE_LEAK create_app_inst_data
489429 RESOURCE_LEAK create_app_inst_data

Change-Id: I66abedc11fb85ca25edecb689d0d3eb2a59d4535
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
parser/msg_parser.c
preload/preload_debugfs.c
preload/preload_module.c
us_manager/sspt/sspt_file.c

index 5e21d86..415d0bb 100644 (file)
@@ -793,6 +793,7 @@ free_func:
                list_del(&fi->list);
                destroy_func_inst_data(fi);
        }
+       kfree(li);
 
 free_path:
        put_string(path);
@@ -937,13 +938,13 @@ struct app_inst_data *create_app_inst_data(struct msg_buf *mb)
 
        if (get_u32(mb, &cnt_func)) {
                print_err("failed to read count of functions\n");
-               goto err;
+               goto free_app_inst;
        }
        print_parse_debug("func count:%d", cnt_func);
 
        if (remained_mb(mb) / MIN_SIZE_FUNC_INST < cnt_func) {
                print_err("to match count of functions(%u)\n", cnt_func);
-               goto err;
+               goto free_app_inst;
        }
 
        if (cnt_func) {
@@ -995,6 +996,10 @@ free_func:
                destroy_func_inst_data(func);
        }
 
+free_app_inst:
+       put_string(app_inst->path);
+       put_string(app_inst->id);
+
 err:
        kfree(app_inst);
 
index 07161b0..60bfd2c 100644 (file)
@@ -267,7 +267,7 @@ static ssize_t bin_list_read(struct file *file, char __user *usr_buf,
        if (files_cnt == 0) {
                printk(PRELOAD_PREFIX "Cannot read binaries names!\n");
                ret = 0;
-               goto bin_list_read_out;
+               goto bin_list_read_fail;
        }
 
        for (i = 0; i < files_cnt; i++)
index 09bd9a6..253b422 100644 (file)
@@ -598,7 +598,7 @@ static int preload_us_entry(struct uretprobe_instance *ri, struct pt_regs *regs)
 
                        /* jump only if caller is instumented and it is not a system lib -
                         * this leads to some errors */
-                       if (((cvma->vm_file != NULL) &&
+                       if ((cvma != NULL) && ((cvma->vm_file != NULL) &&
                             (cvma->vm_file->f_path.dentry != NULL) &&
                             !preload_control_check_dentry_is_ignored(cvma->vm_file->f_path.dentry)) &&
                            __check_flag_and_call_type(ip, ct) &&
index 27a8a2b..e017a67 100644 (file)
@@ -195,6 +195,8 @@ void sspt_file_add_ip(struct sspt_file *file, struct img_ip *img_ip)
 
        offset = img_ip->addr & PAGE_MASK;
        page = sspt_find_page_or_new(file, offset);
+       if (!page)
+               return;
 
        /* FIXME: delete ip */
        ip = create_ip(img_ip);