Re: [linus:master] [mm] c6307674ed: BUG:sleeping_function_called_from_invalid_context_at_mm/vmalloc.c

Herbert Xu <[email protected]> Wed, 22 Apr 2026 13:32:35 +0800
Newsgroups dev.linux.lists.oe-lkp,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On Tue, Apr 21, 2026 at 02:36:26PM +0200, Uladzislau Rezki wrote:
>
> <snip>
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index 6074ed5f66f3..a892766dcedd 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -473,7 +473,7 @@ static int rhashtable_insert_rehash(struct rhashtable *ht,
>  
>  	err = rhashtable_rehash_attach(ht, tbl, new_tbl);
>  	if (err) {
> -		bucket_table_free(new_tbl);
> +		call_rcu(&new_tbl->rcu, bucket_table_free_rcu);
>  		if (err == -EEXIST)
>  			err = 0;
>  	} else
> <snip>
> 
> Could you please check? The problem here is
> 
> rcu_read_lock()
>     rhashtable_insert_rehash()
>         vfree();
> rcu_read_unlokc();
> 
> we can just defer freeing via call_rcu().

I think we should fix that warning instead.  The memory
that's being freed here was just allocated in exactly the
same context through kvmalloc with GFP_ATOMIC.  I can't
see why you're allowed to call kvmalloc but not kvfree.

That makes no sense.

Cheers,
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt