lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <b63b7981191777a6d175cfa98379e987281b9e3a.1742528326.git.houwenlong.hwl@antgroup.com>
Date: Fri, 21 Mar 2025 11:54:42 +0800
From: "Hou Wenlong" <houwenlong.hwl@...group.com>
To: linux-kernel@...r.kernel.org
Cc: "Hou Wenlong" <houwenlong.hwl@...group.com>,
  "Arnd Bergmann" <arnd@...db.de>,
  "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Subject: [PATCH] char: misc: Use __register_chrdev() to register the actual minor counts

In commit ab760791c0cf ("char: misc: Increase the maximum number of
dynamic misc devices to 1048448"), the minor number of misc char device
is increased to MINORMASK + 1. However, it still uses register_chrdev(),
which defaults to registering the misc char device with only 256 minor
numbers.  Therefore, when a misc device is given a minor number greater
than 255, the device file fails to open in kobj_lookup(). As a solution,
use __register_chrdev() to register the actual minor counts to
accommodate this increase.

Signed-off-by: Hou Wenlong <houwenlong.hwl@...group.com>
---
In our environment, the per-cpu coresight_tmc driver occupies too many
minor numbers, which ultimately allocates minor number 256 for our misc
device, resulting in a failure to open the device file in /dev. I'm not
sure if this is a bug or if userspace can only use fewer than 256 minor
numbers. Therefore, I didn't add a fix tag here.
---
 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 f7dd455dd0dd..dda466f9181a 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -315,7 +315,7 @@ static int __init misc_init(void)
 		goto fail_remove;
 
 	err = -EIO;
-	if (register_chrdev(MISC_MAJOR, "misc", &misc_fops))
+	if (__register_chrdev(MISC_MAJOR, 0, MINORMASK + 1, "misc", &misc_fops))
 		goto fail_printk;
 	return 0;
 
-- 
2.31.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ