• Thinh Nguyen's avatar
    usb: dwc3: gadget: Don't setup more than requested · 5d187c04
    Thinh Nguyen authored
    The SG list may be set up with entry size more than the requested
    length. Check the usb_request->length and make sure that we don't setup
    the TRBs to send/receive more than requested. This case may occur when
    the SG entry is allocated up to a certain minimum size, but the request
    length is less than that. It can also occur when the request is reused
    for a different request length.
    
    Cc: <stable@vger.kernel.org> # v4.18+
    Fixes: a31e63b6 ("usb: dwc3: gadget: Correct handling of scattergather lists")
    Signed-off-by: default avatarThinh Nguyen <thinhn@synopsys.com>
    Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
    5d187c04
gadget.c 97.1 KB