13
0
Fork 1

HACK: Use "0xDE" instead of "0xDEC" for the major number

Workaround the issues that the com_on_air_cs.ko kernel module could not be loaded:

insmod com_on_air_cs.ko
-> insmod: ERROR: could not insert module com_on_air_cs.ko: Invalid parameters

dmesg
-> CHRDEV "com_on_air_cs" major requested (3564) is greater than the maximum (511)

CHRDEV_MAJOR_MAX is set to "512" in the kernel
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/linux/fs.h
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/char_dev.c

com_on_air_cs uses 0xDEC (int 3564) which is greater than this maximum.
 -> Workaround: Use 0xDE (int  222) instead.

This already conflicts with a reserved (but probably not widely used) allocation:
https://www.kernel.org/doc/Documentation/admin-guide/devices.txt

Real fix:
* Use Dynamic Major Number allocation instead of assigning a static one.
This commit is contained in:
Martin Hauke 2023-12-16 14:49:30 +01:00
parent 75d82e718b
commit e8cfb775e7
6 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ reload:
node: $(NODE)
$(NODE):
mknod $@ --mode 660 c 3564 0 ### 3564 == 0xDEC
mknod $@ --mode 660 c 222 0 ### 222 == 0xDE
# chgrp dect $(NODE)
read: node coa_read

View File

@ -745,7 +745,7 @@ static int __init init_com_on_air_cs(void)
goto init_out_3;
}
ret = register_chrdev(0xDEC, COA_DEVICE_NAME, &coa_fops);
ret = register_chrdev(0xDE, COA_DEVICE_NAME, &coa_fops);
if (ret < 0)
{
printk("couldn't register_chrdev()\n");
@ -773,7 +773,7 @@ static int __init init_com_on_air_cs(void)
init_out_0:
kfifo_free(&dev->rx_fifo);
init_out_1:
unregister_chrdev(0xDEC, COA_DEVICE_NAME);
unregister_chrdev(0xDE, COA_DEVICE_NAME);
init_out_2:
pcmcia_unregister_driver(&coa_driver);
init_out_3:
@ -787,7 +787,7 @@ static void __exit exit_com_on_air_cs(void)
if (!dev) return;
unregister_chrdev(0xDEC, COA_DEVICE_NAME);
unregister_chrdev(0xDE, COA_DEVICE_NAME);
pcmcia_unregister_driver(&coa_driver);

View File

@ -136,7 +136,7 @@ int main(int argc, char *argv[])
write_global_header(pcap);
//sniff-loop
while (0xDEC + 't')
while (0xDE + 't')
{
struct sniffed_packet buf;
while (sizeof(struct sniffed_packet) == (ret = read(d, &buf, (sizeof(struct sniffed_packet)))))

View File

@ -1001,7 +1001,7 @@ void mainloop(void)
int ret;
while (0xDEC + 'T')
while (0xDE + 'T')
{
tv.tv_sec = 1;
tv.tv_usec = 0;

View File

@ -259,7 +259,7 @@ void *scanthread(void *threadid)
}
while(0xDEC + 'T') // ;)
while(0xDE + 'T') // ;)
{
dect_found found;

View File

@ -263,7 +263,7 @@ void *syncthread(void *threadid)
psaver.openfilerfpi(RFPI);
while (0xDEC + 'T')
while (0xDE + 'T')
{
tv.tv_sec = 1;
tv.tv_usec = 0;