Hi,

i prepared a patch which fix a problem with the rndis_host module and Nokia 
S60 mobiles:
http://bugzilla.kernel.org/show_bug.cgi?id=7201

best regards,
Daniel



From: Daniel Gollub <[EMAIL PROTECTED]>

Bug fix for driver rndis_host which fixes rndis_host probing certain 
Nokia S60 (Series 60) mobiles. While the rndis_host get probed by usbnet
and tries to bind the Nokia mobile the bind is going to fail. The
rndis_host module tries to release the device, in a wrong way, which
cause the oops.

Fixes Bugzilla #7201

Signed-off-by: Daniel Gollub <[EMAIL PROTECTED]>

---

--- linux-2.6.20-rc4/drivers/usb/net/rndis_host.c.orig  2007-01-15 
19:23:01.000000000 +0100
+++ linux-2.6.20-rc4/drivers/usb/net/rndis_host.c       2007-01-15 
19:23:11.000000000 +0100
@@ -379,6 +379,7 @@
 {
        int                     retval;
        struct net_device       *net = dev->net;
+       struct cdc_state        *info = (void *) &dev->data;
        union {
                void                    *buf;
                struct rndis_msg_hdr    *header;
@@ -397,7 +398,7 @@
                return -ENOMEM;
        retval = usbnet_generic_cdc_bind(dev, intf);
        if (retval < 0)
-               goto done;
+               goto fail;
 
        net->hard_header_len += sizeof (struct rndis_data_hdr);
 
@@ -412,10 +413,7 @@
        if (unlikely(retval < 0)) {
                /* it might not even be an RNDIS device!! */
                dev_err(&intf->dev, "RNDIS init failed, %d\n", retval);
-fail:
-               usb_driver_release_interface(driver_of(intf),
-                       ((struct cdc_state *)&(dev->data))->data);
-               goto done;
+               goto fail_and_release;
        }
        dev->hard_mtu = le32_to_cpu(u.init_c->max_transfer_size);
        /* REVISIT:  peripheral "alignment" request is ignored ... */
@@ -431,7 +429,7 @@
        retval = rndis_command(dev, u.header);
        if (unlikely(retval < 0)) {
                dev_err(&intf->dev, "rndis get ethaddr, %d\n", retval);
-               goto fail;
+               goto fail_and_release;
        }
        tmp = le32_to_cpu(u.get_c->offset);
        if (unlikely((tmp + 8) > (1024 - ETH_ALEN)
@@ -439,7 +437,7 @@
                dev_err(&intf->dev, "rndis ethaddr off %d len %d ?\n",
                        tmp, le32_to_cpu(u.get_c->len));
                retval = -EDOM;
-               goto fail;
+               goto fail_and_release;
        }
        memcpy(net->dev_addr, tmp + (char *)&u.get_c->request_id, ETH_ALEN);
 
@@ -455,11 +453,18 @@
        retval = rndis_command(dev, u.header);
        if (unlikely(retval < 0)) {
                dev_err(&intf->dev, "rndis set packet filter, %d\n", retval);
-               goto fail;
+               goto fail_and_release;
        }
 
        retval = 0;
-done:
+
+       kfree(u.buf);
+       return retval;
+
+fail_and_release:      
+       usb_set_intfdata(info->data, NULL);
+       usb_driver_release_interface(driver_of(intf), info->data);
+fail:  
        kfree(u.buf);
        return retval;
 }

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to