From nobody Thu Jun 30 09:40:14 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 73E00876156; Thu, 30 Jun 2022 09:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LYYGQ2gBPz3tb8; Thu, 30 Jun 2022 09:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656582014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5TYZZKp3ACL1CyUCN+RQRAc11iVpwlBDrIsXC1uVEpY=; b=KHYuVbRSFZTazMZN/EkxVNvm0fz2ySULti8JtPM9XxY1Q7Uk7rIptRZtze0tb0QDo9A1Or z+t36S1UFReJxIeiNiD3iCo+UGLMJUHbbT8YiLt3dPloJxEWwB7FZqfRl4gidfwHvzfrCd zaelUhxurc676QQj2AzyoZTL5a9LMzkk+tlDppiKsrG5or3j1vCdOc5RwLzsJSOTxS+Qc+ Xble1bxOnTmq0ZdOkzF6Yu45FxO1x77WE+OSKB/OTamXn/rn4NVY/2eYpSYWHuKOfoPnfF Mp6+2/35xI0KPSSRYxuEXHvy0Hzc10AJRt8KWx5OrIZdqmLbGhd9fnlmkEF36w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BC1323BFD; Thu, 30 Jun 2022 09:40:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25U9eESa078494; Thu, 30 Jun 2022 09:40:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25U9eEJF078488; Thu, 30 Jun 2022 09:40:14 GMT (envelope-from git) Date: Thu, 30 Jun 2022 09:40:14 GMT Message-Id: <202206300940.25U9eEJF078488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 20d32249196e - stable/13 - uhid(4): Don't read-ahead from the USB IN endpoint. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 20d32249196ea6122b481bd61841337a67855337 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656582014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5TYZZKp3ACL1CyUCN+RQRAc11iVpwlBDrIsXC1uVEpY=; b=FnrSiex7gdKbPCnzIOcy9m4y3EvCPaJZN28qW3DeI0cO08BQUfM1vfIeXljA+35CZeG3Nr fD+tGoOpQvGmqzp2uj2Ra4iMIYeYvd1JXQq2XSgBUijmTjZW5Y9jNu2dYAqJVtZy7aCt6M ccG324el/zjxhFK8H5e6EU1sRcWJko1m6LHmKG391gRuq3Q/jj3QoICkaWha+IZ6mSYWa+ wdZsVd78aMdEfZrwVj0el4ZAzItjIA0pjbWNfO8d+8Zh8p7QGZaHk8GeK4WvcvqCvoScQ3 n8oMGca1Rz0kP66J4QsJmRKxzBFFYh8mfU85AjYU2tBQDsUV0XQnUx85+lWgNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656582014; a=rsa-sha256; cv=none; b=O6GnXCYRuouCJ5GOJB3+qMNXohGax0Qkx6sqjut3lOUwVuFf6PYUs4TNaz56Z4UgQrgAuR OHO4n6TLe4d0ugIzTd913goOgiK32L1tlI9F2b+o4z6WftAGbYSfdtkhDn84I6gKW0SarL v5Q9mFBJkhZ6pZhDPp6c1BzqUkSEtGrOhRZtI/Yk1YE4Ed4/HY+wj+DbcGdf7adfL0d7c1 3x17NXcTe3BrSAFxOAsCMPf0AtRyb3YqbkCXBONgNKaiUeLYuALxce9qhRWbo0S62c8u0E 2IbSSXktQyqmq5COQhVdbTb3I+NwDw0wBkB0gGGhW2/icm7KITPF9yxtGY61uA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=20d32249196ea6122b481bd61841337a67855337 commit 20d32249196ea6122b481bd61841337a67855337 Author: Hans Petter Selasky AuthorDate: 2022-06-23 17:39:21 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-30 09:39:43 +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 97f9b1c8edea..cbab992a1343 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);