summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2002-10-30 01:18:58 +0000
committeriedowse <iedowse@FreeBSD.org>2002-10-30 01:18:58 +0000
commit792310e7697ae9822b86915ae13160cb53dd1f23 (patch)
tree3f354ffeb9a09a8ee03f78caac1f8289faf9f468 /sys
parentc98f436d671549d7b42411fc962f851659e903c6 (diff)
downloadFreeBSD-src-792310e7697ae9822b86915ae13160cb53dd1f23.zip
FreeBSD-src-792310e7697ae9822b86915ae13160cb53dd1f23.tar.gz
Check for errors and zero-length transfers in the ulpt_input() input
pipe callback function, and just return if these cases are detected. Without these checks, the ulpt driver may cause an infinite loop of failing USB transfers that can hang the whole machine. This makes printing work for me on a HP DJ950C printer.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/ulpt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c
index 3494d07..b2640f4 100644
--- a/sys/dev/usb/ulpt.c
+++ b/sys/dev/usb/ulpt.c
@@ -471,6 +471,12 @@ static void
ulpt_input(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
{
struct ulpt_softc *sc = priv;
+ u_int32_t count;
+
+ /* Don't loop on errors or 0-length input. */
+ usbd_get_xfer_status(xfer, NULL, NULL, &count, NULL);
+ if (status != USBD_NORMAL_COMPLETION || count == 0)
+ return;
DPRINTFN(2,("ulpt_input: got some data\n"));
/* Do it again. */
OpenPOWER on IntegriCloud