Commit e223b6dc authored by Rami Rosen's avatar Rami Rosen Committed by John W. Linville

rt2x00: fix a wrong parameter for __test_and_clear_bit() in rt2x00rfkill_free().

When running modprobe rt73usb, and then rmmod rt73usb, and then
iwconfig, the wlan0 device does not disappear. When repeating this
process again, we get a kernel Oops errors and "BUG: unable to handle
kernel paging request..." message in the kernel log.

The reason for this is that there is an error in rt2x00rfkill_free(),
which is called in the process of removing the device
(rt2x00lib_remove_dev() in rt2x00dev.c).
rt2x00rfkill_free() clears the RFKILL_STATE_ALLOCATED bit , which is
bit number 1 () in rt2x00dev->flags instead of in
rt2x00dev->rfkill_state. As a result, when checking the
DEVICE_STATE_REGISTERED_HW bit (bit number 1 in rt2x00dev->flags) in
rt2x00lib_remove_hw() it is **unset**, and we wrongly **don't** call

This patch corrects this: the parameter for __test_and_clear_bit() in
rt2x00rfkill_free() should be &rt2x00dev->rfkill_state and not
Signed-off-by: default avatarRami Rosen <>
Acked-by: default avatarIvo van Doorn <>
Signed-off-by: default avatarJohn W. Linville <>
parent 02e68a3d
......@@ -162,7 +162,7 @@ void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
if (!test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->flags))
if (!test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
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