# Kernel > 2.6.7 USB modem fix!

## pestilence

This applies to USB modem which stopped working after upgrading your kernel to a version higher than 2.6.7 (2.6.8, 2.6.9).

I had my Netmod USB modem dead after upgrading and this turned out to be a terrible headache since i could not connect to the Net at my home, i don't know why this patch was not included in the higher sources (it's not my patch i found this one on the Linux-usb-development mailing list).

1) Open up the file: /usr/src/linux/drivers/usb/class/cdc-acm.c

2) Find somewhere at line 547 (this can be different from one kernel version to another) the line:

```

if (!buffer) {

      err("Wierd descriptor references");

      return -EINVAL;

   }

```

If you don't have the same line search for a line that contains the -EINVAL (i found out that in kernel versions prior 2.6.9 the !buffer is named !buflen.

3)Comment out this lines (beware backup the file before changing it!).

4) Add the following lines:

```

if (!buflen) {       

     if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endp

oint->extra) {          

        dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint");

        buflen = intf->cur_altsetting->endpoint->extralen;

        buffer = intf->cur_altsetting->endpoint->extra;

     } else {          

        err("Zero length descriptor references");

        return -EINVAL;

     }

  }

```

5) If you have cdc-acm as a module recompile the modules, if you have it inside your kernel recompile your kernel.

Thanks to the Linux-usb-devel Mailing list for this tip...

----------

## asyr

Just a clarification:

in the first code section (the original) the 'if' is related to the 'buffer' variable. In the second code section (the fix) the 'if' is related to the 'buflen' variable.

This is OK or an error ?

----------

## pestilence

It's ok it worked for me just as it is, i totaly erased the first part and used the second one and had no problems, all my usb devices are working properly now.

And for being precise here is the code snip from the source (after the modification):

```

   /*

   if (!buffer) {

      err("Wierd descriptor references");

      return -EINVAL;

   }

   */

   if (!buflen) {

      if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endp

oint->extra) {

         dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint");

         buflen = intf->cur_altsetting->endpoint->extralen;

         buffer = intf->cur_altsetting->endpoint->extra;

      } else {

         err("Zero length descriptor references");

         return -EINVAL;

      }

   }

```

----------

## asyr

Êáëü !

Cool !

----------

## gentoorizer

I had been looking for a month now for this fix!!!!

Thank you Pestilence a LOT!

At last this damn netmod worked. Can you give us the devel-list message id where you found this fix?

Any ideas about how to remove the 'ignore extra header' when initializing cdc_acm driver (found in dmesg)

Thanks again! Time to say goodbye to little 2.6.4....

----------

## theape

Or alternatively, use any mm source after 2.6.9-rc3-mm2 - has the modem fix, and doesn't require manual fiddling of kernel sources.

Although you might want to backout optimize-profile-path-slightly.patch... causes oopses with gnome/mozilla/etc.

----------

