Re: [PATCH] block: fix bio_alloc_bioset slowpath GFP handling
From: Christoph Hellwig
Date: Mon Mar 23 2026 - 02:44:38 EST
On Sun, Mar 22, 2026 at 03:35:10AM +0100, Vasily Gorbik wrote:
> bio_alloc_bioset() first strips __GFP_DIRECT_RECLAIM from the optimistic
> fast allocation attempt with try_alloc_gfp(). If that fast path fails,
> the slowpath checks saved_gfp to decide whether blocking allocation is
> allowed, but then still calls mempool_alloc() with the stripped gfp mask.
> That can lead to a NULL bio pointer being passed into bio_init().
>
> Fix the slowpath by using saved_gfp for the bio and bvec mempool
> allocations.
Looks good, thanks:
Reviewed-by: Christoph Hellwig <hch@xxxxxx>