From: Amit Shah <amitshah@gmx.net>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>,
Jiri Slaby <jslaby@suse.cz>,
gregkh@suse.de, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] USB: serial/usb_wwan, fix tty NULL dereference
Date: Wed, 16 Feb 2011 00:24:29 +0530 [thread overview]
Message-ID: <20110215185428.GF12932@amit-x200.redhat.com> (raw)
In-Reply-To: <4D5AC7AC.2020702@gmail.com>
On (Tue) 15 Feb 2011 [19:36:28], Jiri Slaby wrote:
> > If you're fixing that, might as well return in the 'if' above
>
> No, the urb has to be resubmitted.
Ah; I meant the following, but it hardly matters..
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index b004b2a..ad89228 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -293,25 +293,24 @@ static void usb_wwan_indat_callback(struct urb *urb)
if (status) {
dbg("%s: nonzero status: %d on endpoint %02x.",
__func__, status, endpoint);
- } else {
- tty = tty_port_tty_get(&port->port);
- if (urb->actual_length) {
- tty_insert_flip_string(tty, data, urb->actual_length);
- tty_flip_buffer_push(tty);
- } else
- dbg("%s: empty read urb received", __func__);
- tty_kref_put(tty);
-
- /* Resubmit urb so we continue receiving */
- if (status != -ESHUTDOWN) {
- err = usb_submit_urb(urb, GFP_ATOMIC);
- if (err && err != -EPERM)
- printk(KERN_ERR "%s: resubmit read urb failed. "
- "(%d)", __func__, err);
- else
- usb_mark_last_busy(port->serial->dev);
- }
-
+ return;
+ }
+ tty = tty_port_tty_get(&port->port);
+ if (urb->actual_length) {
+ tty_insert_flip_string(tty, data, urb->actual_length);
+ tty_flip_buffer_push(tty);
+ } else
+ dbg("%s: empty read urb received", __func__);
+ tty_kref_put(tty);
+
+ /* Resubmit urb so we continue receiving */
+ if (status != -ESHUTDOWN) {
+ err = usb_submit_urb(urb, GFP_ATOMIC);
+ if (err && err != -EPERM)
+ printk(KERN_ERR "%s: resubmit read urb failed. "
+ "(%d)", __func__, err);
+ else
+ usb_mark_last_busy(port->serial->dev);
}
}
Amit
--
http://log.amitshah.net/
next prev parent reply other threads:[~2011-02-15 18:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-15 14:55 Jiri Slaby
2011-02-15 17:14 ` Sergei Shtylyov
2011-02-15 18:10 ` Amit Shah
2011-02-15 18:36 ` Jiri Slaby
2011-02-15 18:54 ` Amit Shah [this message]
2011-02-15 18:42 ` 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=20110215185428.GF12932@amit-x200.redhat.com \
--to=amitshah@gmx.net \
--cc=gregkh@suse.de \
--cc=jirislaby@gmail.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sshtylyov@mvista.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
all inboxes | Powered by JetHome®