From nobody Thu Jun 23 19:12:02 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 5E9E286586F; Thu, 23 Jun 2022 19:12:03 +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 4LTVHQ6VTfz4RSB; Thu, 23 Jun 2022 19:12:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656011523; 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=mUTUvpTGydpNOB6xMXPGj1JB55MvFxVF9cLFeCgxVsc=; b=x4g4kp99UTYKeqJPg+RRtfEo0lM6vP/keiBhakFEvP1tcvrxfQN86Laak3FWz0a6fQRrQi Uo7Wd6fIulUr6LqncXFsyGOAIrViVfEV/FE5XvAMY2B1XSWbyB8WDW8sniFuLeho443mbI 6vMgHyK0NXCVQ9JJPWXPZp959MGTRdQEDgBYVF8ny/lOsAn0Kmh8S596hoOz5yUbw/9aKI nlxUN3RGv5cw/2nvl5bAZaPgFT/8RHWALGoLQp+uI9IRnE2av85D+nXe2ipK6//Onrq3oR 1pycVur+1SZ99qh/X7v/DTiUjABKpTWRiatl+bWwSkHdzJ7lfzSCvXLk9z6iKA== 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 A53C52109C; Thu, 23 Jun 2022 19:12:02 +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 25NJC2BB096599; Thu, 23 Jun 2022 19:12:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25NJC2uj096598; Thu, 23 Jun 2022 19:12:02 GMT (envelope-from git) Date: Thu, 23 Jun 2022 19:12:02 GMT Message-Id: <202206231912.25NJC2uj096598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: b6f615255d8b - main - 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/main X-Git-Reftype: branch X-Git-Commit: b6f615255d8bcdf40604005b11998eee86872364 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656011523; 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=mUTUvpTGydpNOB6xMXPGj1JB55MvFxVF9cLFeCgxVsc=; b=WOuEf4VbxuYNNuarRMNAKpV/4vYZsywQG1GIFTRidRqU9ONrVYgxi22vC7Hogh3poaUNKR pj8pichPXn5PM/z+HgmIsTDfziHF7n2PnvOFwhpI7sry8uVHciYQgtVfZ8W3rNHyVWV/Xa axnYWEwID61Nbe52iu1AZqd2ZRcpgCSbuo/5xwWXC49jjTJfGsZ5jpOhrlZRTSVjM1TV83 TRLexxa2A7CZ8XEa1p3c3CQ2l1ZTaa6fdlVGXLCJzKElF0z2YpkvX36NztC0cNbsfMg9CV 44MUygDeskkUdj56K65noVgpUbRc4/r/w8APocUPJtUe3j1I+Z1RR7j4ezbpoA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656011523; a=rsa-sha256; cv=none; b=FhiYBactMZi/GJnC5FXCnRCe683ZNf/uJynfzxMLa8JDzpgOVnFKcwJaDQG4BJ0NBtNoLL jTwXJf2nYVD/fQSTFXoFtpWt/XRWcjWZQLc4EaT0J3oVZWRDyPPSuOjkEygKHaAleWLAXX fH5ofvI3OrMUpE3/wD7lVlri5Ks4zi8fstXByIJiWx8XiJmf71Oj5rKn+kdvO/bhYiXB9p j8QvysI7/MfS2orKMAaK2ILK0ykObm+hA4R7eER0iL2RalHG2EbyBi8gbtZS+KK4BtE02/ MEt1rCvNUJiAyMyRDvkd+zZ+mPPzZ43ecapjHXWhTOKIoGx08Zrx9vLgSehHtQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b6f615255d8bcdf40604005b11998eee86872364 commit b6f615255d8bcdf40604005b11998eee86872364 Author: Hans Petter Selasky AuthorDate: 2022-06-23 17:39:21 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-23 19:11:24 +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 MFC after: 1 week Sponsored by: NVIDIA Networking --- 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 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);