Skip to content

Commit

Permalink
Merge pull request hathach#2950 from espressif/fix/ncm_buffer_validation
Browse files Browse the repository at this point in the history
fix(ncm): Return invalid NTBs to free list
  • Loading branch information
HiFiPhile authored Jan 22, 2025
2 parents 2d7d107 + 6476ff1 commit feb41ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/class/net/ncm_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,8 @@ bool netd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
// - if there is a free receive buffer, initiate reception
if (!recv_validate_datagram(ncm_interface.recv_tinyusb_ntb, xferred_bytes)) {
// verification failed: ignore NTB and return it to free
TU_LOG_DRV("(EE) VALIDATION FAILED. WHAT CAN WE DO IN THIS CASE?\n");
TU_LOG_DRV("Invalid datatagram. Ignoring NTB\n");
recv_put_ntb_into_free_list(ncm_interface.recv_tinyusb_ntb);
} else {
// packet ok -> put it into ready list
recv_put_ntb_into_ready_list(ncm_interface.recv_tinyusb_ntb);
Expand Down

0 comments on commit feb41ee

Please sign in to comment.