Thread: [Ndiswrapper-general] [PATCH] Panic on unload with DISABLE_USB
Status: Beta
Brought to you by:
pgiri
From: Pavel R. <pr...@gn...> - 2006-08-06 04:57:07
|
Hello! There is one more problem with DISABLE_USB. If ndiswrapper is compiled with DISABLE_USB but there are config files for USB devices, unloading the module causes kernel oops. It happens because ndiswrapper still counts USB devices and allocates space for them, but never puts valid data there. On unload, loader_exit() goes through all devices, whether initialized or not. The solution is not to count USB devices if they are not supported. Please consider two more changes to protect against similar breakage in the future. I didn't include them to keep my patch minimal. 1) Define wrap_is_usb_bus to 0 if CONFIG_USB is not defined. 2) Use "i" instead of "num_pci + num_usb" in register_devices(). ChangeLog: Don't count USB devices if USB support is disabled. Otherwise, some memory is wasted and the driver oopses on unload. Index: driver/loader.c =================================================================== --- driver/loader.c (revision 1981) +++ driver/loader.c (working copy) @@ -631,8 +631,10 @@ for (i = 0; i < load_devices->count; i++) if (wrap_is_pci_bus(devices[i].bus_type)) num_pci++; +#if defined(CONFIG_USB) else if (wrap_is_usb_bus(devices[i].bus_type)) num_usb++; +#endif else WARNING("bus type %d (%d) for %s is not valid", devices[i].bus_type, -- Regards, Pavel Roskin |
From: Giridhar P. <gi...@lm...> - 2006-08-06 10:43:01
|
On Sun, 06 Aug 2006 00:57:03 -0400, Pavel Roskin <pr...@gn...> said: Pavel> 1) Define wrap_is_usb_bus to 0 if CONFIG_USB is not defined. Patch committed to svn. Thanks again. -- Giri |
From: Giridhar P. <gi...@lm...> - 2006-08-06 10:48:03
|
On Sun, 06 Aug 2006 00:57:03 -0400, Pavel Roskin <pr...@gn...> said: Pavel> There is one more problem with DISABLE_USB. If ndiswrapper Pavel> is compiled with DISABLE_USB but there are config files for Pavel> USB devices, unloading the module causes kernel oops. Thanks! Committed to svn. Pavel> 1) Define wrap_is_usb_bus to 0 if CONFIG_USB is not defined. Yes, this should be done. I haven't committed a patch to address this yet. Need to go through where this is used to make sure it works. Pavel> 2) Use "i" instead of "num_pci + num_usb" in Pavel> register_devices(). No, that would actually revert your patch: 'i' is total number of devices for which drivers is installed, whereas with the patch committed, num_usb is never incremented and stays 0. So num_pci + num_usb gives valid devices that should be registered. -- Giri -- Giri mailto:gi...@lm... Tel:(631)220-9029 (M),(631)632-7943 (O) http://www.cs.sunysb.edu/~giri ----------------------------------------------------------------------------- "As Luce reminded me, he said, without data, without facts, without information, the discussions about public education mean that a person is just another opinion." George W. Bush, Jacksonville, Florida, Sept. 9, 2003 |
From: hggdh <hg...@gm...> - 2006-08-06 16:30:39
|
On Sunday 06 August 2006 05:48, Giridhar Pemmasani wrote: > On Sun, 06 Aug 2006 00:57:03 -0400, Pavel Roskin <pr...@gn...>=20 said: >=20 > Pavel> There is one more problem with DISABLE_USB. If=20 ndiswrapper > Pavel> is compiled with DISABLE_USB but there are config files=20 for > Pavel> USB devices, unloading the module causes kernel oops. >=20 > Thanks! Committed to svn. Will try again using svn code, & make debug. |