Commit 22c5f8f7 authored by C A Subramaniam's avatar C A Subramaniam Committed by Hari Kanigeri

SYSLINK NOTIFY Patch to fix premature read ioctl exit, iounmap related memory leak.

This patch for the notify module fixes the following issues:

	- Random signal of exit event given to the user
	  thread in the read ioctl call.
	- Memory leak because of the absence of
	  iounmap() call.
Signed-off-by: default avatarC A Subramaniam <subramaniam.ca@ti.com>
parent 8af28932
......@@ -536,7 +536,7 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
recv_init_status = 0x0;
driver_obj->ctrl_ptr->proc_ctrl[driver_obj->self_id].
send_init_status = 0x0;
unmap_ducati_virt_mem((u32) driver_obj->ctrl_ptr);
unmap_ducati_virt_mem((u32)(driver_obj->ctrl_ptr));
driver_obj->ctrl_ptr = NULL;
}
......
......@@ -271,12 +271,16 @@ static int notify_drv_read(struct file *filp, char *dst, size_t size,
}
ret_val = copy_to_user((void *)dst, u_buf,
sizeof(struct notify_drv_event_packet));
kfree(u_buf);
if (WARN_ON(ret_val != 0))
ret_val = -EFAULT;
if (u_buf->is_exit == true)
up(notifydrv_state.event_state[i].tersemhandle);
kfree(u_buf);
u_buf = NULL;
func_end:
return ret_val ;
}
......@@ -599,7 +603,8 @@ static int notify_drv_add_buf_by_pid(u16 proc_id, u32 pid,
status = -EFAULT;
goto func_end;
}
u_buf = kmalloc(sizeof(struct notify_drv_event_packet), GFP_ATOMIC);
u_buf = kzalloc(sizeof(struct notify_drv_event_packet), GFP_ATOMIC);
if (u_buf != NULL) {
INIT_LIST_HEAD((struct list_head *)&u_buf->element);
u_buf->proc_id = proc_id;
......@@ -617,7 +622,6 @@ static int notify_drv_add_buf_by_pid(u16 proc_id, u32 pid,
(struct list_head *)
&(notifydrv_state.event_state[i].buf_list));
mutex_unlock(notifydrv_state.gatehandle);
up(notifydrv_state.event_state[i].semhandle);
/* Termination packet */
if (is_exit == true) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment