Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Annotate hardware config module parameters in drivers/net/wan/

When the kernel is running in secure boot mode, we lock down the kernel to
prevent userspace from modifying the running kernel image. Whilst this
includes prohibiting access to things like /dev/mem, it must also prevent
access by means of configuring driver modules in such a way as to cause a
device to access or modify the kernel image.

To this end, annotate module_param* statements that refer to hardware
configuration and indicate for future reference what type of parameter they
specify. The parameter parser in the core sees this information and can
skip such parameters with an error message if the kernel is locked down.
The module initialisation then runs as normal, but just sees whatever the
default values for those parameters is.

Note that we do still need to do the module initialisation because some
drivers have viable defaults set in case parameters aren't specified and
some drivers support automatic configuration (e.g. PNP or PCI) in addition
to manually coded parameters.

This patch annotates drivers in drivers/net/wan/.

Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: "Jan \"Yenya\" Kasprzak" <kas@fi.muni.cz>
cc: netdev@vger.kernel.org

+12 -12
+3 -3
drivers/net/wan/cosa.c
··· 232 232 static struct class *cosa_class; 233 233 234 234 #ifdef MODULE 235 - module_param_array(io, int, NULL, 0); 235 + module_param_hw_array(io, int, ioport, NULL, 0); 236 236 MODULE_PARM_DESC(io, "The I/O bases of the COSA or SRP cards"); 237 - module_param_array(irq, int, NULL, 0); 237 + module_param_hw_array(irq, int, irq, NULL, 0); 238 238 MODULE_PARM_DESC(irq, "The IRQ lines of the COSA or SRP cards"); 239 - module_param_array(dma, int, NULL, 0); 239 + module_param_hw_array(dma, int, dma, NULL, 0); 240 240 MODULE_PARM_DESC(dma, "The DMA channels of the COSA or SRP cards"); 241 241 242 242 MODULE_AUTHOR("Jan \"Yenya\" Kasprzak, <kas@fi.muni.cz>");
+3 -3
drivers/net/wan/hostess_sv11.c
··· 324 324 static int io = 0x200; 325 325 static int irq = 9; 326 326 327 - module_param(io, int, 0); 327 + module_param_hw(io, int, ioport, 0); 328 328 MODULE_PARM_DESC(io, "The I/O base of the Comtrol Hostess SV11 card"); 329 - module_param(dma, int, 0); 329 + module_param_hw(dma, int, dma, 0); 330 330 MODULE_PARM_DESC(dma, "Set this to 1 to use DMA1/DMA3 for TX/RX"); 331 - module_param(irq, int, 0); 331 + module_param_hw(irq, int, irq, 0); 332 332 MODULE_PARM_DESC(irq, "The interrupt line setting for the Comtrol Hostess SV11 card"); 333 333 334 334 MODULE_AUTHOR("Alan Cox");
+2 -2
drivers/net/wan/sbni.c
··· 1463 1463 1464 1464 1465 1465 #ifdef MODULE 1466 - module_param_array(io, int, NULL, 0); 1467 - module_param_array(irq, int, NULL, 0); 1466 + module_param_hw_array(io, int, ioport, NULL, 0); 1467 + module_param_hw_array(irq, int, irq, NULL, 0); 1468 1468 module_param_array(baud, int, NULL, 0); 1469 1469 module_param_array(rxl, int, NULL, 0); 1470 1470 module_param_array(mac, int, NULL, 0);
+4 -4
drivers/net/wan/sealevel.c
··· 363 363 static int irq=5; 364 364 static bool slow=false; 365 365 366 - module_param(io, int, 0); 366 + module_param_hw(io, int, ioport, 0); 367 367 MODULE_PARM_DESC(io, "The I/O base of the Sealevel card"); 368 - module_param(txdma, int, 0); 368 + module_param_hw(txdma, int, dma, 0); 369 369 MODULE_PARM_DESC(txdma, "Transmit DMA channel"); 370 - module_param(rxdma, int, 0); 370 + module_param_hw(rxdma, int, dma, 0); 371 371 MODULE_PARM_DESC(rxdma, "Receive DMA channel"); 372 - module_param(irq, int, 0); 372 + module_param_hw(irq, int, irq, 0); 373 373 MODULE_PARM_DESC(irq, "The interrupt line setting for the SeaLevel card"); 374 374 module_param(slow, bool, 0); 375 375 MODULE_PARM_DESC(slow, "Set this for an older Sealevel card such as the 4012");