[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 3 Mar 2022 07:58:54 +0100
From: Felix Fietkau <nbd@....name>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, John Crispin <john@...ozen.org>,
Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>,
"David S. Miller" <davem@...emloft.net>,
Matthias Brugger <matthias.bgg@...il.com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 03/11] net: ethernet: mtk_eth_soc: add support for
Wireless Ethernet Dispatch (WED)
On 26.02.22 07:18, Jakub Kicinski wrote:
> On Fri, 25 Feb 2022 11:18:02 +0100 Felix Fietkau wrote:
>> + page_list = kcalloc(n_pages, sizeof(*page_list), GFP_KERNEL);
>> + if (!page_list)
>> + return -ENOMEM;
>> +
>> + dev->buf_ring.size = ring_size;
>> + dev->buf_ring.pages = page_list;
>> +
>> + desc = dma_alloc_coherent(dev->hw->dev, ring_size * sizeof(*desc),
>> + &desc_phys, GFP_KERNEL);
>> + if (!desc)
>> + return -ENOMEM;
>> +
>> + dev->buf_ring.desc = desc;
>> + dev->buf_ring.desc_phys = desc_phys;
>> +
>> + for (i = 0, page_idx = 0; i < ring_size; i += MTK_WED_BUF_PER_PAGE) {
>> + dma_addr_t page_phys, buf_phys;
>> + struct page *page;
>> + void *buf;
>> + int s;
>> +
>> + page = __dev_alloc_pages(GFP_KERNEL, 0);
>> + if (!page)
>> + return -ENOMEM;
>
> I haven't looked at the code, yet, but this sure looks leaky.
It's not leaky. If the alloc fails, mtk_wed_detach is still called,
which cleans up even incomplete ring allocations.
- Felix
Powered by blists - more mailing lists