linux/drivers/net/wireless/p54
Hans de Goede d4cde88c1c p54pci: fix regression from prevent stuck rx-ring on slow system
This patch fixes a recently introduced use-after-free regression
from "p54pci: prevent stuck rx-ring on slow system".

Hans de Goede reported a use-after-free regression:
>BUG: unable to handle kernel paging request at 6b6b6b6b
>IP: [<e122284a>] p54p_check_tx_ring+0x84/0xb1 [p54pci]
>*pde = 00000000
>Oops: 0000 [#1] SMP
>EIP: 0060:[<e122284a>] EFLAGS: 00010286 CPU: 0
>EIP is at p54p_check_tx_ring+0x84/0xb1 [p54pci]
>EAX: 6b6b6b6b EBX: df10b170 ECX: 00000003 EDX: 00000001
>ESI: dc471500 EDI: d8acaeb0 EBP: c098be9c ESP: c098be84
> DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
>Process swapper (pid: 0, ti=c098a000 task=c09ccfe0 task.ti=c098a000)
>Call Trace:
> [<e1222b02>] ? p54p_tasklet+0xaa/0xb5 [p54pci]
> [<c0440568>] ? tasklet_action+0x78/0xcb
> [<c0440ed3>] ? __do_softirq+0xbc/0x173

Quote from comment #17:
"The problem is the innocent looking moving of the tx processing to
 after the rx processing in the tasklet. Quoting from the changelog:
  This patch does it the same way, except that it also prioritize
  rx data processing, simply because tx routines *can* wait.

 This is causing an issue with us referencing already freed memory,
 because some skb's we transmit, we immediately receive back, such
 as those for reading the eeprom (*) and getting stats.

 What can happen because of the moving of the tx processing to after
 the rx processing is that when the tasklet first runs after doing a
 special skb tx (such as eeprom) we've already received the answer
 to it.

 Then the rx processing ends up calling p54_find_and_unlink_skb to
 find the matching tx skb for the just received special rx skb and
 frees the tx skb.

 Then after the processing of the rx skb answer, and thus freeing
 the tx skb, we go process the completed tx ring entires, and then
 dereference the free-ed skb, to see if it should free free-ed by
 p54p_check_tx_ring()."

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=583623
Bug-Identified-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-04-26 14:21:15 -04:00
..
Kconfig wireless: remove WLAN_80211 and WLAN_PRE80211 from Kconfig 2009-10-30 16:50:35 -04:00
Makefile p54: Modify p54 files for new organization 2009-07-10 15:02:24 -04:00
eeprom.c p54: disable channels with incomplete calibration data sets 2009-11-02 15:43:23 -05:00
eeprom.h
fwio.c p54: implement rfkill 2009-08-14 09:13:45 -04:00
led.c mac80211: redefine usage of the mac80211 workqueue 2009-08-04 16:44:14 -04:00
lmac.h p54: fix beaconing related firmware crash 2009-07-24 15:05:21 -04:00
main.c p54: Enable HW_REPORTS_TX_ACK_STATUS 2010-03-09 15:02:56 -05:00
net2280.h
p54.h p54: remove get_tx_stats() mac80211 op 2010-02-08 16:51:01 -05:00
p54pci.c p54pci: fix regression from prevent stuck rx-ring on slow system 2010-04-26 14:21:15 -04:00
p54pci.h p54pci: move tx cleanup into tasklet 2010-01-19 16:43:12 -05:00
p54spi.c spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
p54spi.h
p54spi_eeprom.h
p54usb.c Add USB ID for Thomson SpeedTouch 120g to p54usb id table 2010-03-30 15:37:26 -04:00
p54usb.h
txrx.c wireless/prism54: remove trailing space in messages 2010-03-31 14:39:07 -04:00