mirror of https://github.com/torvalds/linux.git
Smatch reported that nents is not initialized and used in
stub_recv_cmd_submit(). nents is currently initialized by sgl_alloc()
and used to allocate multiple URBs when host controller doesn't
support scatter-gather DMA. The use of uninitialized nents means that
buf_len is zero and use_sg is true. But buffer length should not be
zero when an URB uses scatter-gather DMA.
To prevent this situation, add the conditional that checks buf_len
and use_sg. And move the use of nents right after the sgl_alloc() to
avoid the use of uninitialized nents.
If the error occurs, it adds SDEV_EVENT_ERROR_MALLOC and stub_priv
will be released by stub event handler and connection will be shut
down.
Fixes:
|
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| stub.h | ||
| stub_dev.c | ||
| stub_main.c | ||
| stub_rx.c | ||
| stub_tx.c | ||
| usbip_common.c | ||
| usbip_common.h | ||
| usbip_event.c | ||
| vhci.h | ||
| vhci_hcd.c | ||
| vhci_rx.c | ||
| vhci_sysfs.c | ||
| vhci_tx.c | ||
| vudc.h | ||
| vudc_dev.c | ||
| vudc_main.c | ||
| vudc_rx.c | ||
| vudc_sysfs.c | ||
| vudc_transfer.c | ||
| vudc_tx.c | ||