Re: [PATCH v2] misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors

From: Greg KH
Date: Tue Oct 15 2024 - 03:53:45 EST


On Tue, Oct 15, 2024 at 07:02:26AM +0000, Vimal Agrawal wrote:
> misc_minor_alloc was allocating id using ida for minor only in case of
> MISC_DYNAMIC_MINOR but misc_minor_free was always freeing ids
> using ida_free causing a mismatch and following warn:
> > > WARNING: CPU: 0 PID: 159 at lib/idr.c:525 ida_free+0x3e0/0x41f
> > > ida_free called for id=127 which is not allocated.
> > > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> ...
> > > [<60941eb4>] ida_free+0x3e0/0x41f
> > > [<605ac993>] misc_minor_free+0x3e/0xbc
> > > [<605acb82>] misc_deregister+0x171/0x1b3
>
> misc_minor_alloc is changed to allocate id from ida for all minors
> falling in the range of dynamic/ misc dynamic minors
>
> Fixes: 0ad35fed618c ("char: misc: Increase the maximum number of dynamic misc devices to 1048448")
> Signed-off-by: Vimal Agrawal <vimal.agrawal@xxxxxxxxxx>
> ---
> drivers/char/misc.c | 35 +++++++++++++++++-----
> lib/Kconfig.debug | 11 +++++++
> lib/Makefile | 1 +
> lib/test_misc_minor.c | 67 +++++++++++++++++++++++++++++++++++++++++++

Cool, thanks for the test, but shouldn't that be a separate patch? That
doesn't need to be backported anywhere :)

Can you split this up into a 2 patch series?

Also, you need to fix your "From:" line, it does not match up with your
signed-off-by: line :(

thanks,

greg k-h