The rtl8192e procfs-based debug interface seems very broken
The procfs-based debug interface in:
drivers/staging/rtl8192e/rtl8192e/rtl_debug.c
seems to be very broken because:
(1) proc_get_stats_ap() walks ieee->network_list with no locking.
(2) There is no locking against normal driver operations whilst we wangle the device registers. Admittedly, this may not modify the device state since all the pages appear memory-mapped rather than bank-swapped - but if there are any read-to-ack type regs, then this is bad.
(3) We send the device commands and await replies - again without locking against the normal driver (eg. proc_get_cam_register_*()).
David
Quoted 8 lines · David Howells
The procfs-based debug interface in:
drivers/staging/rtl8192e/rtl8192e/rtl_debug.cseems to be very broken because:
(1)
proc_get_stats_ap()walksieee->network_listwith no locking.
Quoted 7 lines
(2) There is no locking against normal driver operations whilst we wangle the device registers. Admittedly, this may not modify the device state since all the pages appear memory-mapped rather than bank-swapped - but if there are any read-to-ack type regs, then this is bad.
(3) We send the device commands and await replies - again without locking against the normal driver (eg. proc_get_cam_register_*()).
David,
That whole driver is quite broken.
My initial response would be to delete the whole procfs structure. I have one of those devices, but I never use it. At the moment, I do not have time to add locking and test the changes.
Larry
Quoted 7 lines · On Mon, 08 Apr 2013 17:31:44 -0500 Larry Finger <[email protected]>…
David,
That whole driver is quite broken.
My initial response would be to delete the whole procfs structure. I have one of those devices, but I never use it. At the moment, I do not have time to add locking and test the changes.
The driver isn't optimal, but I use it daily in one laptop. So it does work, it just has a few quirks :D
Is the procfs structure only used for debugging? Unless it is used by user mode tools, I have never used it. I may try quickly commenting it out and see if things still work.
Cheers,
Sean
Quoted 6 lines · Sean MacLennan
The driver isn't optimal, but I use it daily in one laptop. So it does work, it just has a few quirks :D
Is the procfs structure only used for debugging? Unless it is used by user mode tools, I have never used it. I may try quickly commenting it out and see if things still work.
As far as I know, it is only for debugging.
Larry
The procfs debug code in rtl_debug.c is, ironically, very buggy: it lacks proper locking. Since the most useful part of the code (the stats) are available through more standard APIs, I think it is best to just delete the whole mess.
---
drivers/staging/rtl8192e/rtl8192e/Makefile +0 -0
@@ -7,7 +7,6 @@ r8192e_pci-objs := \
r8190P_rtl8256.o \ rtl_cam.o \ rtl_core.o \ - rtl_debug.o \ rtl_dm.o \ rtl_eeprom.o \ rtl_ethtool.o \
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -0
@@ -2966,8 +2966,6 @@ static int rtl8192_pci_probe(struct pci_dev *pdev,
goto err_free_irq; RT_TRACE(COMP_INIT, "dev name: %s\n", dev->name);
- rtl8192_proc_init_one(dev);
-
if (priv->polling_timer_on == 0) check_rfctrl_gpio_timer((unsigned long)dev);
@@ -3003,7 +3001,6 @@ static void rtl8192_pci_disconnect(struct pci_dev *pdev)
del_timer_sync(&priv->gpio_polling_timer);
cancel_delayed_work(&priv->gpio_change_rf_wq);
priv->polling_timer_on = 0;
- rtl8192_proc_remove_one(dev);
rtl8192_down(dev, true);
deinit_hal_dm(dev);
if (priv->pFirmware) {
@@ -3093,7 +3090,6 @@ static int __init rtl8192_pci_module_init(void)
printk(KERN_INFO "\nLinux kernel driver for RTL8192E WLAN cards\n");
printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan Driver\n");- rtl8192_proc_module_init();
if (0 != pci_register_driver(&rtl8192_pci_driver)) {
DMESG("No device found");
/*pci_unregister_driver (&rtl8192_pci_driver);*/
@@ -3107,7 +3103,6 @@ static void __exit rtl8192_pci_module_exit(void)
pci_unregister_driver(&rtl8192_pci_driver);
RT_TRACE(COMP_DOWN, "Exiting");- rtl8192_proc_module_remove();
}
void check_rfctrl_gpio_timer(unsigned long data)
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -0
@@ -1085,10 +1085,4 @@ void ActUpdateChannelAccessSetting(struct net_device *dev,
enum wireless_mode WirelessMode, struct channel_access_setting *ChnlAccessSetting);
-/* proc stuff from rtl_debug.c */
-void rtl8192_proc_init_one(struct net_device *dev); -void rtl8192_proc_remove_one(struct net_device *dev); -void rtl8192_proc_module_init(void);
-void rtl8192_proc_module_remove(void);
-
#endif
drivers/staging/rtl8192e/rtl8192e/rtl_debug.c deleted +0 -1029
1,029 lines not on this page · raw message
Quoted 3 lines · Sean MacLennan
The procfs debug code in
rtl_debug.cis, ironically, very buggy: it lacks proper locking. Since the most useful part of the code (the stats) are available through more standard APIs, I think it is best to just delete the whole mess.
OK... Seeing that I've ended up collecting procfs-related fixes all over the place this cycle, applied.