[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220602212415.71bc5133@kernel.org>
Date: Thu, 2 Jun 2022 21:24:15 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Chen Lin <chen45464546@....com>
Cc: nbd@....name, john@...ozen.org, sean.wang@...iatek.com,
Mark-MC.Lee@...iatek.com, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, matthias.bgg@...il.com, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
alexander.duyck@...il.com
Subject: Re: [PATCH] net: ethernet: mtk_eth_soc: fix misuse of mem alloc
interface netdev_alloc_frag
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().
Powered by blists - more mailing lists