usb: msc: Stall data stage before sending error status

When an unsupported SCSI command is received, an error status reply
is sent even if the Host expects data prior to the status.

This fix stalls the data reply before sending the error status.

Signed-off-by: Audun Korneliussen <audun.korneliussen@nordicsemi.no>
This commit is contained in:
Audun Korneliussen 2020-03-02 12:48:08 +01:00 committed by Johan Hedberg
commit 8fac501c0f

View file

@ -491,6 +491,11 @@ static bool infoTransfer(void)
static void fail(void)
{
if (cbw.DataLength) {
/* Stall data stage */
usb_ep_set_stall(mass_ep_data[MSD_IN_EP_IDX].ep_addr);
}
csw.Status = CSW_FAILED;
sendCSW();
}