usb: gadget: avoid exposing kernel stack
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 8 May 2016 21:20:59 +0000 (23:20 +0200)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 31 May 2016 08:24:30 +0000 (11:24 +0300)
Function in_rq_cur copies random bytes from the stack.
Zero the memory instead.

Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/function/f_uac2.c

index 1c81dd3b0cd41d2f957bd4aa6d0bb5f053f842ab..cd214ec8a601b4913b67f7d67e52fb8c57e003c4 100644 (file)
@@ -1280,6 +1280,7 @@ in_rq_cur(struct usb_function *fn, const struct usb_ctrlrequest *cr)
 
        if (control_selector == UAC2_CS_CONTROL_SAM_FREQ) {
                struct cntrl_cur_lay3 c;
+               memset(&c, 0, sizeof(struct cntrl_cur_lay3));
 
                if (entity_id == USB_IN_CLK_ID)
                        c.dCUR = p_srate;