aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2022-06-23 17:39:21 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2022-06-23 19:11:24 +0000
commitb6f615255d8bcdf40604005b11998eee86872364 (patch)
tree154273bb1bc147e5cbbff89c2d5be254197a9cfc /sys/dev/usb
parentf5766992c0d0491d571cb6d1c47f373314f527a8 (diff)
downloadsrc-b6f615255d8bcdf40604005b11998eee86872364.tar.gz
src-b6f615255d8bcdf40604005b11998eee86872364.zip
uhid(4): Don't read-ahead from the USB IN endpoint.
This avoids an issue where IN endpoint data received from the device right before the file handle is closed, gets lost. PR: 263995 MFC after: 1 week Sponsored by: NVIDIA Networking
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/input/uhid.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c
index d795e8fa6bbc..42cde9e2d7ef 100644
--- a/sys/dev/usb/input/uhid.c
+++ b/sys/dev/usb/input/uhid.c
@@ -218,6 +218,12 @@ uhid_intr_read_callback(struct usb_xfer *xfer, usb_error_t error)
actlen = sc->sc_isize;
usb_fifo_put_data(sc->sc_fifo.fp[USB_FIFO_RX], pc,
0, actlen, 1);
+
+ /*
+ * Do not do read-ahead, because this may lead
+ * to data loss!
+ */
+ return;
} else {
/* ignore it */
DPRINTF("ignored transfer, %d bytes\n", actlen);