Re: [PATCH] net: ethernet: mtk_eth_soc: fix misuse of mem alloc interface netdev_alloc_frag
From: Jakub Kicinski
Date: Fri Jun 03 2022 - 00:24:31 EST
On Fri, 3 Jun 2022 12:10:35 +0800 Chen Lin wrote:
> - ring->data[i] = netdev_alloc_frag(ring->frag_size);
> + if (ring->frag_size <= PAGE_SIZE)
> + ring->data[i] = netdev_alloc_frag(ring->frag_size);
> + else
> + ring->data[i] = kmalloc(ring->frag_size, GFP_KERNEL);
Is it legal to allocate pages with kmalloc()? I mean they will end up
getting freed by page_frag_free(), not kfree().
Also there's more frag allocations here, search for napi_alloc_frag().