]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
char: misc: deallocate static minor in error path
authorThadeu Lima de Souza Cascardo <cascardo@igalia.com>
Thu, 23 Jan 2025 12:32:49 +0000 (09:32 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:15 +0000 (13:02 +0100)
commit4e8df56636e3f525e02bb068deb998c70fd0813a
tree00d713dfdd7de26d7e503299e6b9c874fc96aa2e
parent80fc880991ae4e2d50d86f5117318bc643c71b36
char: misc: deallocate static minor in error path

commit 6d991f569c5ef6eaeadf1238df2c36e3975233ad upstream.

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 <stable@kernel.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Link: https://lore.kernel.org/r/20250123123249.4081674-5-cascardo@igalia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/misc.c