USB: gadget: zero allocate endpoint 0 buffers
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Dec 2021 18:02:15 +0000 (19:02 +0100)
committerPDO SCM Team <hudsoncm@motorola.com>
Mon, 7 Mar 2022 12:41:06 +0000 (06:41 -0600)
commit42262a0a0a1af9ab6e5698c4f4830decfe96e3c9
treefe3583d03414c24a411bcfe2aed52c591f8ed136
parent545ea44ea986a3e91bb2561dcc5181011f327d0a
USB: gadget: zero allocate endpoint 0 buffers

commit 86ebbc11bb3f60908a51f3e41a17e3f477c2eaa3 upstream.

Under some conditions, USB gadget devices can show allocated buffer
contents to a host.  Fix this up by zero-allocating them so that any
extra data will all just be zeros.

Mot-CRs-fixed: (CR)
CVE-Fixed: CVE-2021-39685
Bug: 210292376

Change-Id: I5f4fdbf7b0c241f60d7b27539110c167ba8e7e00
Reported-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Tested-by: Szymon Heidrich <szymon.heidrich@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gajjala Chakradhar <gajjalac@motorola.com>
Reviewed-on: https://gerrit.mot.com/2197706
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
drivers/usb/gadget/composite.c
drivers/usb/gadget/legacy/dbgp.c