Skip to content

Commit

Permalink
staging: ti dspbridge: avoid possible NULL dereference panic
Browse files Browse the repository at this point in the history
When dsp_notifications array is received from user,
dspbridge verifies the array has valid pointers
and dsp_notification structures. However, these
structures contain pointers that need to be
checked for valid handles.

Signed-off-by: Ernesto Ramos <ernesto@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ernesto Ramos authored and Greg Kroah-Hartman committed Aug 3, 2010
1 parent 019415c commit 35f338e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/staging/tidspbridge/pmgr/dspapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ u32 mgrwrap_unregister_object(union trapped_args *args, void *pr_ctxt)
*/
u32 mgrwrap_wait_for_bridge_events(union trapped_args *args, void *pr_ctxt)
{
int status = 0, real_status = 0;
int status = 0;
struct dsp_notification *anotifications[MAX_EVENTS];
struct dsp_notification notifications[MAX_EVENTS];
u32 index, i;
Expand All @@ -554,19 +554,21 @@ u32 mgrwrap_wait_for_bridge_events(union trapped_args *args, void *pr_ctxt)
/* get the events */
for (i = 0; i < count; i++) {
CP_FM_USR(&notifications[i], anotifications[i], status, 1);
if (!status) {
/* set the array of pointers to kernel structures */
anotifications[i] = &notifications[i];
if (status || !notifications[i].handle) {
status = -EINVAL;
break;
}
/* set the array of pointers to kernel structures */
anotifications[i] = &notifications[i];
}
if (!status) {
real_status = mgr_wait_for_bridge_events(anotifications, count,
status = mgr_wait_for_bridge_events(anotifications, count,
&index,
args->args_mgr_wait.
utimeout);
}
CP_TO_USR(args->args_mgr_wait.pu_index, &index, status, 1);
return real_status;
return status;
}

/*
Expand Down

0 comments on commit 35f338e

Please sign in to comment.