Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Jun 2022 09:42:04 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e81b8c36e757 - stable/12 - uhid(4): Don't read-ahead from the USB IN endpoint.
Message-ID:  <202206300942.25U9g4gk086477@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=e81b8c36e7578b5986c4837868eaee00711d6293

commit e81b8c36e7578b5986c4837868eaee00711d6293
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-06-23 17:39:21 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-06-30 09:41:26 +0000

    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
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit b6f615255d8bcdf40604005b11998eee86872364)
---
 sys/dev/usb/input/uhid.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c
index 2caaf8e02861..d295daf13a69 100644
--- a/sys/dev/usb/input/uhid.c
+++ b/sys/dev/usb/input/uhid.c
@@ -213,6 +213,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206300942.25U9g4gk086477>