All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] staging: alarm-dev: information leak in alarm_ioctl()
@ 2013-06-03  9:02 Dan Carpenter
  2013-06-03 19:08 ` John Stultz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dan Carpenter @ 2013-06-03  9:02 UTC (permalink / raw)
  To: kernel-janitors

Smatch complains that 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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c
index ceb1c643..c8600d9 100644
--- a/drivers/staging/android/alarm-dev.c
+++ b/drivers/staging/android/alarm-dev.c
@@ -264,6 +264,8 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	}
 
 	rv = alarm_do_ioctl(file, cmd, &ts);
+	if (rv)
+		return rv;
 
 	switch (ANDROID_ALARM_BASE_CMD(cmd)) {
 	case ANDROID_ALARM_GET_TIME(0):
@@ -272,7 +274,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		break;
 	}
 
-	return rv;
+	return 0;
 }
 #ifdef CONFIG_COMPAT
 static long alarm_compat_ioctl(struct file *file, unsigned int cmd,

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-05  0:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03  9:02 [patch] staging: alarm-dev: information leak in alarm_ioctl() Dan Carpenter
2013-06-03 19:08 ` John Stultz
2013-06-04 13:13 ` [patch] staging: alarm-dev: information leak in alarm_compat_ioctl() Dan Carpenter
2013-06-05  0:07 ` Arve Hjønnevåg
2013-06-05  0:25 ` John Stultz
2013-06-05  0:49 ` Arve Hjønnevåg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.