linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: tom.rosary@googlemail.com
Cc: Xose Vazquez Perez <xose.vazquez@gmail.com>,
	linux-usb@vger.kernel.org,
	linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: bugreport upstream: 0bda:819a RTL8188CUS WLAN doesn't work out of the box
Date: Wed, 06 Feb 2013 13:05:22 -0600	[thread overview]
Message-ID: <5112A972.3060109@lwfinger.net> (raw)
In-Reply-To: <51045387.2040607@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 783 bytes --]

On 01/26/2013 04:07 PM, Xose Vazquez Perez wrote:
> Thomas Rosenkranz wrote:
>
>> 0bda:819a RTL8188CUS WLAN doesn't work out of the box in downstream
>> and upstreamkernel
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1102179
>
> This should go to <linux-wireless@vger.kernel.org>
>
> Try:
> # modprobe rtl8192cu
> # echo "0bda 819a" > /sys/bus/usb/drivers/rtl8192cu/new_id
> # dmesg (see output)

Please install the attached patch, and retry the above method. I fixed the probe 
function to get rid of the oops. If the device is really foreign, the process 
that writes new_id will not finish until the device is unplugged; however, the 
rest of the system is chugging along.

If 0bda:819a works with rtl8192cu, let me know, and I'll update the USB device 
table.

Larry


[-- Attachment #2: 0001-rtlwifi-rtl8192cu-Fix-NULL-dereference-BUG-when-usin.patch --]
[-- Type: text/x-patch, Size: 3001 bytes --]

>From 2bd60bf2a4b91c9ae4e552568c4b76e238fc01a9 Mon Sep 17 00:00:00 2001
From: Larry Finger <Larry.Finger@lwfinger.net>
Date: Wed, 6 Feb 2013 12:41:36 -0600
Subject: [PATCH V2] rtlwifi: rtl8192cu: Fix NULL dereference BUG when using
 new_id
To: linville@tuxdriver.com
Cc: netdev@vger.kernel.org

When the new_id entry in /sysfs is used for a foreign USB device, rtlwifi
BUGS with a NULL pointer dereference because the per-driver configuration
data is not available. The probe function has been restructured as
suggested by Ben Hutchings <bhutchings@solarflare.com>.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Stable <stable@vger.kernel.org>
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 8 +++++++-
 drivers/net/wireless/rtlwifi/usb.c          | 5 +++--
 drivers/net/wireless/rtlwifi/usb.h          | 3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index d9e659f..577c0dc 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -363,9 +363,15 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
 
 MODULE_DEVICE_TABLE(usb, rtl8192c_usb_ids);
 
+static int rtl8192cu_probe(struct usb_interface *intf,
+			   const struct usb_device_id *id)
+{
+	return rtl_usb_probe(intf, id, &rtl92cu_hal_cfg);
+}
+
 static struct usb_driver rtl8192cu_driver = {
 	.name = "rtl8192cu",
-	.probe = rtl_usb_probe,
+	.probe = rtl8192cu_probe,
 	.disconnect = rtl_usb_disconnect,
 	.id_table = rtl8192c_usb_ids,
 
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index d42bbe2..476eaef 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -937,7 +937,8 @@ static struct rtl_intf_ops rtl_usb_ops = {
 };
 
 int rtl_usb_probe(struct usb_interface *intf,
-			const struct usb_device_id *id)
+		  const struct usb_device_id *id,
+		  struct rtl_hal_cfg *rtl_hal_cfg)
 {
 	int err;
 	struct ieee80211_hw *hw = NULL;
@@ -972,7 +973,7 @@ int rtl_usb_probe(struct usb_interface *intf,
 	usb_set_intfdata(intf, hw);
 	/* init cfg & intf_ops */
 	rtlpriv->rtlhal.interface = INTF_USB;
-	rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_info);
+	rtlpriv->cfg = rtl_hal_cfg;
 	rtlpriv->intf_ops = &rtl_usb_ops;
 	rtl_dbgp_flag_init(hw);
 	/* Init IO handler */
diff --git a/drivers/net/wireless/rtlwifi/usb.h b/drivers/net/wireless/rtlwifi/usb.h
index 5235136..fb986f9 100644
--- a/drivers/net/wireless/rtlwifi/usb.h
+++ b/drivers/net/wireless/rtlwifi/usb.h
@@ -157,7 +157,8 @@ struct rtl_usb_priv {
 
 
 int rtl_usb_probe(struct usb_interface *intf,
-			    const struct usb_device_id *id);
+		  const struct usb_device_id *id,
+		  struct rtl_hal_cfg *rtl92cu_hal_cfg);
 void rtl_usb_disconnect(struct usb_interface *intf);
 int rtl_usb_suspend(struct usb_interface *pusb_intf, pm_message_t message);
 int rtl_usb_resume(struct usb_interface *pusb_intf);
-- 
1.8.1


  reply	other threads:[~2013-02-06 19:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-26 22:07 bugreport upstream: 0bda:819a RTL8188CUS WLAN doesn't work out of the box Xose Vazquez Perez
2013-02-06 19:05 ` Larry Finger [this message]
2013-02-06 20:03   ` Thomas Rosenkranz
2013-02-06 23:56     ` Larry Finger
     [not found]       ` <CAOAX8-=_D9PncnaCGkfFKBkenxppQ-EksEQk5UwFKtBY+toRaQ@mail.gmail.com>
     [not found]         ` <CAOAX8-nafHZiCYYP2-ApLMKJ-d3HKcbkENeztpPjLKv39EEzig@mail.gmail.com>
     [not found]           ` <CAOAX8-nCRm2S0OX8TeNmZ9HGe0MB8UmA-huWE_QctgDhtFrZEA@mail.gmail.com>
     [not found]             ` <5113D9C0.1080501@gmail.com>
     [not found]               ` <CAOAX8-k28rV4mx3D9U_jLHbVPmphEd0ZsfwPp4TatVxkdts=_w@mail.gmail.com>
     [not found]                 ` <CAOAX8-m-nOLtSXAnWGHia8U2qsp_QPnJ-O0cqUy2FWwoLFh-_g@mail.gmail.com>
     [not found]                   ` <5113DCC2.3070306@gmail.com>
2013-02-07 17:01                     ` Fwd: " Thomas Rosenkranz
2013-02-07 17:38                       ` Larry Finger
2013-02-06 23:03   ` Xose Vazquez Perez
2013-02-06 23:50     ` Larry Finger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5112A972.3060109@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tom.rosary@googlemail.com \
    --cc=xose.vazquez@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).