From: Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> Date: Tue, 6 Jun 2017 00:08:10 +0200 > Commit a47b70ea86bd ("ravb: unmap descriptors when freeing rings") has > introduced the issue seen in [1] reproduced on H3ULCB board. > > Fix this by relocating the RX skb ringbuffer free operation, so that > swiotlb page unmapping can be done first. Freeing of aligned TX buffers > is not relevant to the issue seen in [1]. Still, reposition TX free > calls as well, to have all kfree() operations performed consistently > _after_ dma_unmap_*()/dma_free_*(). > > [1] Console screenshot with the problem reproduced: > > salvator-x login: root > root@salvator-x:~# ifconfig eth0 up > Micrel KSZ9031 Gigabit PHY e6800000.ethernet-ffffffff:00: \ > attached PHY driver [Micrel KSZ9031 Gigabit PHY] \ > (mii_bus:phy_addr=e6800000.ethernet-ffffffff:00, irq=235) > IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready > root@salvator-x:~# > root@salvator-x:~# ifconfig eth0 down > ================================================================== > BUG: KASAN: use-after-free in swiotlb_tbl_unmap_single+0xc4/0x35c ... > ================================================================== > Disabling lock debugging due to kernel taint > root@salvator-x:~# > > Fixes: a47b70ea86bd ("ravb: unmap descriptors when freeing rings") > Signed-off-by: Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> Applied and queued up for -stable, thanks.