Re: [PATCH] block: fix 'kmem_cache of name 'bio-108' already exists'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 28, 2025 at 09:26:56PM +0800, Ming Lei wrote:
> Device mapper bioset often has big bio_slab size, which can be more than
> 1000, then 8byte can't hold the slab name any more, cause the kmem_cache
> allocation warning of 'kmem_cache of name 'bio-108' already exists'.
> 
> Fix the warning by extending bio_slab->name to 12 bytes, but fix output
> of /proc/slabinfo
> 
> Reported-by: Guangwu Zhang <guazhang@xxxxxxxxxx>
> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> ---
>  block/bio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index f0c416e5931d..6ac5983ba51e 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -77,7 +77,7 @@ struct bio_slab {
>  	struct kmem_cache *slab;
>  	unsigned int slab_ref;
>  	unsigned int slab_size;
> -	char name[8];
> +	char name[12];

Can you please turn this into a pointer and use kasprintf to fill
it?  That way we fix the string overflow problem for real and don't
need to doctor around it the next time someone uses names with a
longer name.





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux