twx-linux/drivers/char
Thadeu Lima de Souza Cascardo 5f253cc40e char: misc: register chrdev region with all possible minors
commit c876be906ce7e518d9ef9926478669c151999e69 upstream.

register_chrdev will only register the first 256 minors of a major chrdev.
That means that dynamically allocated misc devices with minor above 255
will fail to open with -ENXIO.

This was found by kernel test robot when testing a different change that
makes all dynamically allocated minors be above 255. This has, however,
been separately tested by creating 256 serio_raw devices with the help of
userio driver.

Ever since allowing misc devices with minors above 128, this has been
possible.

Fix it by registering all minor numbers from 0 to MINORMASK + 1 for
MISC_MAJOR.

Reported-by: kernel test robot <oliver.sang@intel.com>
Cc: stable <stable@kernel.org>
Closes: https://lore.kernel.org/oe-lkp/202503171507.6c8093d0-lkp@intel.com
Fixes: ab760791c0cf ("char: misc: Increase the maximum number of dynamic misc devices to 1048448")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Tested-by: Hou Wenlong <houwenlong.hwl@antgroup.com>
Link: https://lore.kernel.org/r/20250317-misc-chrdev-v1-1-6cd05da11aef@igalia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-05-02 07:50:49 +02:00
..
agp
hw_random hwrng: cctrng - Add missing clk_disable_unprepare in cctrng_resume 2024-10-04 16:29:55 +02:00
ipmi ipmi: ssif_bmc: Fix new request loss when bmc ready for a response 2025-02-08 09:51:55 +01:00
mwave
tpm tpm: do not start chip while suspended 2025-04-25 10:45:27 +02:00
xilinx_hwicap
xillybus char: xillybus: Check USB endpoints when probing device 2024-08-29 17:33:11 +02:00
adi.c
apm-emulation.c
applicom.c
applicom.h
bsr.c
ds1620.c
dsp56k.c
dtlk.c
hangcheck-timer.c
hpet.c hpet: Support 32-bit userspace 2024-07-18 13:21:19 +02:00
Kconfig
lp.c
Makefile
mem.c
misc.c char: misc: register chrdev region with all possible minors 2025-05-02 07:50:49 +02:00
mspec.c
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c
ppdev.c ppdev: Add an error check in register_device 2024-06-12 11:12:26 +02:00
ps3flash.c
random.c random: handle creditable entropy from atomic process context 2024-04-27 17:11:30 +02:00
scx200_gpio.c
sonypi.c
tlclk.c
toshiba.c
ttyprintk.c
uv_mmtimer.c
virtio_console.c virtio_console: fix missing byte order handling for cols and rows 2025-05-02 07:50:45 +02:00