espressif / esp-lwip

Fork of lwIP (https://savannah.nongnu.org/projects/lwip/) with ESP-IDF specific patches
Other
79 stars 126 forks source link

Fix SLIP RX linked list append. (IDFGH-4356) #25

Closed webworxshop closed 3 years ago

webworxshop commented 3 years ago

Append to the linked list of pbuf objects was broken so that the second (and subsequent) packets received in a SLIP transaction would be appended to themselves and consequently lost.

This resulted in these packets being dropped and the system suffering extreme memory leakage.

/cc @ryankurte

Alvin1Zhang commented 3 years ago

Thanks for your contribution.

david-cermak commented 3 years ago

@webworxshop Thanks very much for posting this fix! Interesting that this bug seems to be present in the lwip upstream, too.

Possibly, the reason why this bug was never discovered, might be, the esp-idf's port of slip input processing. I think if we moved the slipif_process_rxqueue() few lines up, we might never have seen the issue, as the rx-queue would be continuously processing the pbuf's before they start to queue. Anyway, this is should be fixed here, as you propose.

david-cermak commented 3 years ago

@webworxshop Thanks again for the fix, merged as https://github.com/espressif/esp-lwip/commit/01d0ecff2d5de8b7b7f0d32664a5baa71e941281