aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2017-02-08 06:18:10 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-18 01:11:47 -0400
commitcb794d57931b77c6a43b662333772a1ba3bd5342 (patch)
tree8011604ebaca2a82965da7671ea7a71bc5b4d9cf /drivers/net/wireless
parent938f8e856064c0a7890ab998ec66abf1d093fd18 (diff)
rt2x00usb: fix anchor initialization
commit 0488a6121dfe6cbd44de15ea3627913b7549a1e9 upstream. If device fail to initialize we can OOPS in rt2x00lib_remove_dev(), due to using uninitialized usb_anchor structure: [ 855.435820] ieee80211 phy3: rt2x00usb_vendor_request: Error - Vendor Request 0x07 failed for offset 0x1000 with error -19 [ 855.435826] ieee80211 phy3: rt2800_probe_rt: Error - Invalid RT chipset 0x0000, rev 0000 detected [ 855.435829] ieee80211 phy3: rt2x00lib_probe_dev: Error - Failed to allocate device [ 855.435845] BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 [ 855.435900] IP: _raw_spin_lock_irq+0xd/0x30 [ 855.435926] PGD 0 [ 855.435953] Oops: 0002 [#1] SMP <snip> [ 855.437011] Call Trace: [ 855.437029] ? usb_kill_anchored_urbs+0x27/0xc0 [ 855.437061] rt2x00lib_remove_dev+0x190/0x1c0 [rt2x00lib] [ 855.437097] rt2x00lib_probe_dev+0x246/0x7a0 [rt2x00lib] [ 855.437149] ? ieee80211_roc_setup+0x9e/0xd0 [mac80211] [ 855.437183] ? __kmalloc+0x1af/0x1f0 [ 855.437207] ? rt2x00usb_probe+0x13d/0xc50 [rt2x00usb] [ 855.437240] rt2x00usb_probe+0x155/0xc50 [rt2x00usb] [ 855.437273] rt2800usb_probe+0x15/0x20 [rt2800usb] [ 855.437304] usb_probe_interface+0x159/0x2d0 [ 855.437333] driver_probe_device+0x2bb/0x460 Patch changes initialization sequence to fix the problem. Cc: Vishal Thanki <vishalthanki@gmail.com> Fixes: 8b4c0009313f ("rt2x00usb: Use usb anchor to manage URB") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Cc: Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ralink/rt2x00/rt2x00usb.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
index 6005e14213ca..4104cf5608e2 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00usb.c
@@ -824,10 +824,6 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
824 if (retval) 824 if (retval)
825 goto exit_free_device; 825 goto exit_free_device;
826 826
827 retval = rt2x00lib_probe_dev(rt2x00dev);
828 if (retval)
829 goto exit_free_reg;
830
831 rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev, 827 rt2x00dev->anchor = devm_kmalloc(&usb_dev->dev,
832 sizeof(struct usb_anchor), 828 sizeof(struct usb_anchor),
833 GFP_KERNEL); 829 GFP_KERNEL);
@@ -835,10 +831,17 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,
835 retval = -ENOMEM; 831 retval = -ENOMEM;
836 goto exit_free_reg; 832 goto exit_free_reg;
837 } 833 }
838
839 init_usb_anchor(rt2x00dev->anchor); 834 init_usb_anchor(rt2x00dev->anchor);
835
836 retval = rt2x00lib_probe_dev(rt2x00dev);
837 if (retval)
838 goto exit_free_anchor;
839
840 return 0; 840 return 0;
841 841
842exit_free_anchor:
843 usb_kill_anchored_urbs(rt2x00dev->anchor);
844
842exit_free_reg: 845exit_free_reg:
843 rt2x00usb_free_reg(rt2x00dev); 846 rt2x00usb_free_reg(rt2x00dev);
844 847