Re: [PATCH v2 0/6] remove dead NULL checks after GFP_NOFAIL allocations and fix xive use-after-free

From: Leon Romanovsky

Date: Sun Jul 26 2026 - 04:26:39 EST


On Sat, Jul 25, 2026 at 08:26:32PM -0700, Andrew Morton wrote:
> On Fri, 24 Jul 2026 10:28:45 +0800 Gou Hao <gouhao@xxxxxxxxxxxxx> wrote:
>
> > This is a code cleanup series that removes unreachable
> > NULL checks (and associated error handling) that follow allocations
> > using __GFP_NOFAIL, which guarantees non-NULL return.
>
> Sigh.
>
> Back when Linux ran on an abacus, I added __GFP_NOFAIL because four or
> five sites (file systems) were infinitely looping on alloc_pages until
> it succeeded. I figured we should move this operation into the page
> allocator so we could easily find those sites and fix them to Not Do
> That.
>
> I made it very clear (changelog and code comments) that no new code
> should use __GFP_NOFAIL. How did that work out?
>
> hp2:/usr/src/linux-7.2-rc4> grep -r __GFP_NOFAIL | wc -l
> 241
>
> So much lameness! My immediate reaction to your patchset is "No. Fix
> the damn code instead". But I've resoundingly lost that fight.
>
>
> Thanks, I'll scoop up the entire series. If individual patches pop up
> in linux-next then I'll drop the mm.git copies.
>
>
>
> AI review has a shower of possible pre-existing issues. I'm seeing
> use-after-free, double-free, leak, system hang, NULL pointer
> dereference, usual stuff :(
>
> They're in powerpc and cxgb4, if maintainers are interested.
>
> https://sashiko.dev/#/patchset/20260724022851.466017-1-gouhao@xxxxxxxxxxxxx

Regarding cxgb4, yes, I'm looking into it.

Thanks