On Thu, Jan 23, 2025 at 09:32:49AM -0300, Thadeu Lima de Souza Cascardo wrote: > When creating sysfs files fail, the allocated minor must be freed such that > it can be later reused. That is specially harmful for static minor numbers, > since those would always fail to register later on. > > Fixes: 6d04d2b554b1 ("misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors") > Cc: stable@xxxxxxxxxxxxxxx > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxx> > --- > drivers/char/misc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/misc.c b/drivers/char/misc.c > index 7a768775e558..7843a1a34d64 100644 > --- a/drivers/char/misc.c > +++ b/drivers/char/misc.c > @@ -266,8 +266,8 @@ int misc_register(struct miscdevice *misc) > device_create_with_groups(&misc_class, misc->parent, dev, > misc, misc->groups, "%s", misc->name); > if (IS_ERR(misc->this_device)) { > + misc_minor_free(misc->minor); > if (is_dynamic) { > - misc_minor_free(misc->minor); > misc->minor = MISC_DYNAMIC_MINOR; > } > err = PTR_ERR(misc->this_device); > -- > 2.34.1 > > Having a "fix" as patch 4/4 of a series is a pain, it should go to Linus now, not for the next merge window, right? I'll split this apart by hand, but ugh, please be more careful next time. thanks, greg k-h