mirror of
https://github.com/openwrt/openwrt.git
synced 2026-11-27 19:00:39 +04:00
mtk_wed_rx_reset() frees the rx buffers, and mtk_wed_start() allocates them again. Three cases go wrong: - mtk_wed_free_rx_buffer() and mtk_wed_hwrro_free_buffer() keep the freed pointers, so an allocation failure in the restart leaves them, and __mtk_wed_detach() frees them a second time; - a failed WO state change returns before the free, so the restart overwrites the pointers and the old buffers leak; - mtk_wed_rx_buffer_alloc() ignores the return value of init_rx_buf, and the rx buffer manager then gets descriptors with no valid buffer. Add pending patches 799-01, 799-02 and 799-03. They clear the pointers after the free, reset the rings and free the buffers if the change to the enable state fails, keep the buffers if the change to the reset state fails, since the hardware still fetches from them, and handle a failed init_rx_buf. They apply after patch 798, whose crash the pointer clear would hide. Refresh 799 and mediatek 944, whose hunks the patches shift. Signed-off-by: Felix Fietkau <nbd@nbd.name>