Skip to contentSkip to conversation

drivers/video/sis/sis_main.c: prevent reading uninitialized stack memory

PATCH In review Dan Rosenberg 2 participants 2 messages Sep 15, 2010 – Sep 16, 2010 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/video/sis/sis_main.c: prevent reading uninitialized stack memory

The FBIOGET_VBLANK device ioctl allows unprivileged users to read 16 bytes of uninitialized stack memory, because the "reserved" member of the fb_vblank struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.

drivers/video/sis/sis_main.c +3 -0
@@ -1701,6 +1701,9 @@ static int	sisfb_ioctl(struct fb_info *i
 		break;
 
 	   case FBIOGET_VBLANK:
+
+		memset(&sisvbblank, 0, sizeof(struct fb_vblank));
+
 		sisvbblank.count = 0;
 		sisvbblank.flags = sisfb_setupvbblankflags(ivideo, &sisvbblank.vcount, &sisvbblank.hcount);
 
#1 lore raw
Quoted 10 lines · On Wed, 15 Sep 2010 17:43:53 -0400 Dan Rosenberg <[email protected]>…

The FBIOGET_VBLANK device ioctl allows unprivileged users to read 16 bytes of uninitialized stack memory, because the "reserved" member of the fb_vblank struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.

drivers/video/sis/sis_main.c static int sisfb_ioctl(struct fb_info *i · line 1705

Quoted 5 lines
drivers/video/sis/sis_main.c +2 -0
@@ -1701,6 +1701,9 @@ static int	sisfb_ioctl(struct fb_info *i
 		break;
 
 	   case FBIOGET_VBLANK:
+
+		memset(&sisvbblank, 0, sizeof(struct fb_vblank));

grumble. Every one of these patches I need to go in and check that the types are correct. In this case, that sisvbblank really does have the type `struct fb_vblank'.

If the code had done

		memset(&sisvbblank, 0, sizeof(sisvbblank));

then I wouldn't need to do that.