Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: renesas_usbhs: fix error return code of usbhsf_pkt_handler()

When __usbhsf_pkt_get() returns NULL to pkt, no error return code of
usbhsf_pkt_handler() is assigned.
To fix this bug, ret is assigned with -EINVAL in this case.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20210307090030.22369-1-baijiaju1990@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jia-Ju Bai and committed by
Greg Kroah-Hartman
3af32605 0c59f678

+3 -1
+3 -1
drivers/usb/renesas_usbhs/fifo.c
··· 160 160 usbhs_lock(priv, flags); 161 161 162 162 pkt = __usbhsf_pkt_get(pipe); 163 - if (!pkt) 163 + if (!pkt) { 164 + ret = -EINVAL; 164 165 goto __usbhs_pkt_handler_end; 166 + } 165 167 166 168 switch (type) { 167 169 case USBHSF_PKT_PREPARE: