From: Duncan Sands <baldrick@wanadoo.fr>
To: linux-usb-devel@lists.sourceforge.net
Cc: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] USB speedtouch: discard packets for non-existant vcc's
Date: Sat, 12 Apr 2003 13:49:39 +0200 [thread overview]
Message-ID: <200304121349.39418.baldrick@wanadoo.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]
I broke part of the udsl_decode_rawcell logic in a previous patch, leading to
possible hangs on startup/shutdown. I've attached the 2.4 and 2.5 versions.
Thanks to Subodh Srivastava and Ted Phelps for their bug reports. Here is the
2.5 patch included inline for reference:
--- redux-2.5/drivers/usb/misc/speedtch.c 2003-04-12 11:29:03.000000000 +0200
+++ bollux-2.5/drivers/usb/misc/speedtch.c 2003-04-12 13:35:57.000000000 +0200
@@ -278,9 +278,10 @@
/* here should the header CRC check be... */
- if (!(vcc = udsl_find_vcc (instance, vpi, vci)))
+ if (!(vcc = udsl_find_vcc (instance, vpi, vci))) {
dbg ("udsl_decode_rawcell: no vcc found for packet on vpi %d, vci %d", vpi, vci);
- else {
+ __skb_pull (skb, min (skb->len, (unsigned) 53));
+ } else {
dbg ("udsl_decode_rawcell found vcc %p for packet on vpi %d, vci %d", vcc, vpi, vci);
if (skb->len >= 53) {
@@ -323,8 +324,8 @@
skb_pull (skb, 53);
} else {
/* If data is corrupt and skb doesn't hold a whole cell, flush the lot */
- if (skb_pull (skb, 53) == NULL)
- return NULL;
+ __skb_pull (skb, skb->len);
+ return NULL;
}
}
}
[-- Attachment #2: patch-2.4.diff --]
[-- Type: text/x-diff, Size: 868 bytes --]
--- redux-2.4/drivers/usb/speedtouch.c 2003-04-12 11:23:46.000000000 +0200
+++ bollux-2.4/drivers/usb/speedtouch.c 2003-04-12 11:19:25.000000000 +0200
@@ -278,9 +278,10 @@
/* here should the header CRC check be... */
- if (!(vcc = udsl_find_vcc (instance, vpi, vci)))
+ if (!(vcc = udsl_find_vcc (instance, vpi, vci))) {
dbg ("udsl_decode_rawcell: no vcc found for packet on vpi %d, vci %d", vpi, vci);
- else {
+ __skb_pull (skb, min (skb->len, (unsigned) 53));
+ } else {
dbg ("udsl_decode_rawcell found vcc %p for packet on vpi %d, vci %d", vcc, vpi, vci);
if (skb->len >= 53) {
@@ -323,8 +324,8 @@
skb_pull (skb, 53);
} else {
/* If data is corrupt and skb doesn't hold a whole cell, flush the lot */
- if (skb_pull (skb, 53) == NULL)
- return NULL;
+ __skb_pull (skb, skb->len);
+ return NULL;
}
}
}
[-- Attachment #3: patch-2.5.diff --]
[-- Type: text/x-diff, Size: 874 bytes --]
--- redux-2.5/drivers/usb/misc/speedtch.c 2003-04-12 11:29:03.000000000 +0200
+++ bollux-2.5/drivers/usb/misc/speedtch.c 2003-04-12 13:35:57.000000000 +0200
@@ -278,9 +278,10 @@
/* here should the header CRC check be... */
- if (!(vcc = udsl_find_vcc (instance, vpi, vci)))
+ if (!(vcc = udsl_find_vcc (instance, vpi, vci))) {
dbg ("udsl_decode_rawcell: no vcc found for packet on vpi %d, vci %d", vpi, vci);
- else {
+ __skb_pull (skb, min (skb->len, (unsigned) 53));
+ } else {
dbg ("udsl_decode_rawcell found vcc %p for packet on vpi %d, vci %d", vcc, vpi, vci);
if (skb->len >= 53) {
@@ -323,8 +324,8 @@
skb_pull (skb, 53);
} else {
/* If data is corrupt and skb doesn't hold a whole cell, flush the lot */
- if (skb_pull (skb, 53) == NULL)
- return NULL;
+ __skb_pull (skb, skb->len);
+ return NULL;
}
}
}
next reply other threads:[~2003-04-12 11:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-12 11:49 Duncan Sands [this message]
2003-04-15 5: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=200304121349.39418.baldrick@wanadoo.fr \
--to=baldrick@wanadoo.fr \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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®