Skip to content

Commit

Permalink
staging: alarm-dev: information leak in alarm_compat_ioctl()
Browse files Browse the repository at this point in the history
If we pass an invalid clock type then "ts" is never set.  We need to
check for errors earlier, otherwise we end up passing uninitialized
stack data to userspace.

Reported-by: John Stultz <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Dan Carpenter authored and gregkh committed Jun 4, 2013
1 parent e919b86 commit 60bba38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/android/alarm-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ static long alarm_compat_ioctl(struct file *file, unsigned int cmd,
}

rv = alarm_do_ioctl(file, cmd, &ts);
if (rv)
return rv;

switch (ANDROID_ALARM_BASE_CMD(cmd)) {
case ANDROID_ALARM_GET_TIME(0): /* NOTE: we modified cmd above */
Expand All @@ -305,7 +307,7 @@ static long alarm_compat_ioctl(struct file *file, unsigned int cmd,
break;
}

return rv;
return 0;
}
#endif

Expand Down

0 comments on commit 60bba38

Please sign in to comment.