drivers/video/sis/sis_main.c: prevent reading uninitialized stack memory
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 *ibreak ;case FBIOGET_VBLANK : + +memset (&sisvbblank,0 ,sizeof (struct fb_vblank )); + sisvbblank.count =0 ; sisvbblank.flags =sisfb_setupvbblankflags (ivideo, &sisvbblank.vcount, &sisvbblank.hcount);
Quoted 10 lines · On Wed, 15 Sep 2010 17:43:53 -0400 Dan Rosenberg <[email protected]>…
The
FBIOGET_VBLANKdevice ioctl allows unprivileged users to read 16 bytes of uninitialized stack memory, because the "reserved" member of thefb_vblankstruct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it.Signed-off-by Dan Rosenberg <[email protected]>
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 *ibreak ;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.