embeddedsw icon indicating copy to clipboard operation
embeddedsw copied to clipboard

lwIP: calling pbuf_free in interrupt context without protection in RAW API mode

Open yzhang0231 opened this issue 1 year ago • 0 comments

In bare-metal application derived from a hello world template when default configuration is used, emacps_send_handler will be called in interrupt context, in which xemacps_process_sent_bds calls pbuf_free. https://github.com/Xilinx/embeddedsw/blob/8fca1ac929453ba06613b5417141483b4c2d8cf3/ThirdParty/sw_services/lwip213/src/contrib/ports/xilinx/netif/xemacpsif_dma.c#L289-L305

However, the protection macro for calling mem_free/pbuf_free, LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT, will only be emit to lwipopts.h in SOCKET API mode: https://github.com/Xilinx/embeddedsw/blob/8fca1ac929453ba06613b5417141483b4c2d8cf3/ThirdParty/sw_services/lwip213/data/lwip213.tcl#L546-L575

The user manual from lwIP can be found below: https://github.com/Xilinx/embeddedsw/blob/8fca1ac929453ba06613b5417141483b4c2d8cf3/ThirdParty/sw_services/lwip213/src/lwip-2.1.3/CHANGELOG#L2391-L2395

yzhang0231 avatar Aug 22 '23 06:08 yzhang0231