Commit ad84e4a9 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: g_printer: fix bug in module parameter definitions

This patch (as1442) fixes a bug in g_printer: Module parameters should
not be marked "__initdata" if they are accessible in sysfs (i.e., if
the mode value in the module_param() macro is nonzero).  Otherwise
attempts to access the parameters will cause addressing violations.

Character-string module parameters must not be marked "__initdata"
if the module can be unloaded, because the kernel needs to access the
parameter variable at unload time in order to free the
dynamically-allocated string.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
CC: Roland Kletzing <devzero@web.de>
CC: Craig W. Nadler <craig@nadler.us>
CC: <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d5aa4751
...@@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget; ...@@ -131,31 +131,31 @@ static struct printer_dev usb_printer_gadget;
* parameters are in UTF-8 (superset of ASCII's 7 bit characters). * parameters are in UTF-8 (superset of ASCII's 7 bit characters).
*/ */
static ushort __initdata idVendor; static ushort idVendor;
module_param(idVendor, ushort, S_IRUGO); module_param(idVendor, ushort, S_IRUGO);
MODULE_PARM_DESC(idVendor, "USB Vendor ID"); MODULE_PARM_DESC(idVendor, "USB Vendor ID");
static ushort __initdata idProduct; static ushort idProduct;
module_param(idProduct, ushort, S_IRUGO); module_param(idProduct, ushort, S_IRUGO);
MODULE_PARM_DESC(idProduct, "USB Product ID"); MODULE_PARM_DESC(idProduct, "USB Product ID");
static ushort __initdata bcdDevice; static ushort bcdDevice;
module_param(bcdDevice, ushort, S_IRUGO); module_param(bcdDevice, ushort, S_IRUGO);
MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)");
static char *__initdata iManufacturer; static char *iManufacturer;
module_param(iManufacturer, charp, S_IRUGO); module_param(iManufacturer, charp, S_IRUGO);
MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string");
static char *__initdata iProduct; static char *iProduct;
module_param(iProduct, charp, S_IRUGO); module_param(iProduct, charp, S_IRUGO);
MODULE_PARM_DESC(iProduct, "USB Product string"); MODULE_PARM_DESC(iProduct, "USB Product string");
static char *__initdata iSerialNum; static char *iSerialNum;
module_param(iSerialNum, charp, S_IRUGO); module_param(iSerialNum, charp, S_IRUGO);
MODULE_PARM_DESC(iSerialNum, "1"); MODULE_PARM_DESC(iSerialNum, "1");
static char *__initdata iPNPstring; static char *iPNPstring;
module_param(iPNPstring, charp, S_IRUGO); module_param(iPNPstring, charp, S_IRUGO);
MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment