mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxin John <maxin.john@gmail.com>
To: Erik Slagter <erik@slagter.name>
Cc: linux-kernel@vger.kernel.org
Subject: Re: OOPS after connection Droids MuIn USB display
Date: Fri, 6 May 2011 12:50:33 +0100	[thread overview]
Message-ID: <BANLkTimcWN3=qvurDzyMUs8f5+uFPNumaw@mail.gmail.com> (raw)
In-Reply-To: <4DC3D296.9060707@slagter.name>

Hi Eric,

> In the file drivers/usb/class/cdc-acm.c, around line 1098, there is a
> comment "/*workaround for switched interfaces */" and then a check:
>
> if (data_interface->cur_altsetting->desc.bInterfaceClass !=
> CDC_DATA_INTERFACE_TYPE)
>
> At this point, the variable data_interface is NULL and this causes the OOPS.
>

I have included some checks for "data_interface" since
"usb_ifnum_to_if" could return NULL.
Could you please check by applying this patch ?

Signed-off-by: Maxin B. John <maxin.john@gmail.com>
---
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index e057e53..073f418 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -960,6 +960,10 @@ static int acm_probe(struct usb_interface *intf,
        if (quirks == NO_UNION_NORMAL) {
                data_interface = usb_ifnum_to_if(usb_dev, 1);
                control_interface = usb_ifnum_to_if(usb_dev, 0);
+               if (!data_interface || !control_interface) {
+                       dev_dbg(&intf->dev, "no interfaces\n");
+                       return -ENODEV;
+               }
                goto skip_normal_probe;
        }

@@ -1031,6 +1035,10 @@ next_desc:
                if (call_interface_num > 0) {
                        dev_dbg(&intf->dev, "No union descriptor,
using call management descriptor\n");
                        data_interface = usb_ifnum_to_if(usb_dev,
(data_interface_num = call_interface_num));
+                       if (!data_interface) {
+                               dev_dbg(&intf->dev, "no data interface\n");
+                               return -ENODEV;
+                       }
                        control_interface = intf;
                } else {
                        if (intf->cur_altsetting->desc.bNumEndpoints != 3) {

  reply	other threads:[~2011-05-06 11:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06  8:27 Erik Slagter
2011-05-06 10:51 ` Erik Slagter
2011-05-06 11:50   ` Maxin John [this message]
2011-05-06 16:07     ` Erik Slagter
2011-05-06 16:57     ` Erik Slagter
2011-05-07  0:14       ` Maxin John
2011-05-07  7:02         ` Erik Slagter
2011-05-07 20:02           ` Greg KH
2011-05-08  7:45             ` Erik Slagter
2011-05-08 15:31               ` Greg KH
2011-05-10 18:25             ` Erik Slagter
2011-05-10 18:35               ` Greg KH

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='BANLkTimcWN3=qvurDzyMUs8f5+uFPNumaw@mail.gmail.com' \
    --to=maxin.john@gmail.com \
    --cc=erik@slagter.name \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome