diff options
| author | sakumisu <[email protected]> | 2024-05-12 11:22:37 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2024-05-12 20:47:33 +0800 |
| commit | 074662a50d1e6ded903f47b375891554b82d55f7 (patch) | |
| tree | bfc03b8d9f99f454fd6de9122ecffedc9dfdce1c | |
| parent | 532e05e29393cc6e99fadf02e201f6d05dc2d779 (diff) | |
fix(class/wireless/usbh_rndis): when last data is dummy byte, ignore it
| -rw-r--r-- | class/wireless/usbh_rndis.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/class/wireless/usbh_rndis.c b/class/wireless/usbh_rndis.c index 92fd349f..2deeb3ae 100644 --- a/class/wireless/usbh_rndis.c +++ b/class/wireless/usbh_rndis.c @@ -474,6 +474,9 @@ find_class: g_rndis_rx_length += g_rndis_class.bulkin_urb.actual_length; if (g_rndis_rx_length % USB_GET_MAXPACKETSIZE(g_rndis_class.bulkin->wMaxPacketSize)) { pmg_offset = 0; + + uint32_t total_len = g_rndis_rx_length; + while (g_rndis_rx_length > 0) { USB_LOG_DBG("rxlen:%d\r\n", g_rndis_rx_length); @@ -500,11 +503,17 @@ find_class: } pmg_offset += pmsg->MessageLength; g_rndis_rx_length -= pmsg->MessageLength; + + /* drop the last dummy byte, it is a short packet to tell us we have received a multiple of wMaxPacketSize */ + if (g_rndis_rx_length < 4) { + g_rndis_rx_length = 0; + } } else { g_rndis_rx_length = 0; USB_LOG_ERR("No memory to alloc pbuf for rndis rx\r\n"); } } else { + USB_LOG_ERR("offset:%d,remain:%d,total:%d\r\n", pmg_offset, g_rndis_rx_length, total_len); g_rndis_rx_length = 0; USB_LOG_ERR("Error rndis packet message\r\n"); } |
