From nobody Wed Jun 25 12:40:10 2025 X-Original-To: dev-commits-src-main@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 4bS1cW3150z600Rk; Wed, 25 Jun 2025 12:40:11 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bS1cV6yfQz3pBc; Wed, 25 Jun 2025 12:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750855211; 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=RlOoVJQhjDx+2YUIhcblGQNqlHh0scsVOEZS3SXpVzE=; b=DqS2xsyLySte8uqE97X3H1MQg6L82j4UeOxkDsW790DWVsIeZP5UnlhqjT3u9aTS0iZQiE d4HKHNGTgMKylXXLRJFRL0927C0DSzKTJ2SovDZaHaccRqoT9o5hHXUSQOHJUs6gL0MsXd xzbwIyzd7De5YHi54+VkHnOtsloGHoayRA4TSPj7CcPW1zYd/K3nI09M6ZVKDPPtnhjiQ4 pwyUsqWzJvC+pgHfz2SdXgsiR0pLJYFKxNVrA06wW/aNuG8FZQBnrNyN+TjhiXi+UObDCI qXSytXjjp16lKcPU6663TK5T7HxV/wLHovt67KDhe/MZgqkxndIE2GnE2A3k0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750855211; 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=RlOoVJQhjDx+2YUIhcblGQNqlHh0scsVOEZS3SXpVzE=; b=wWMh3sR9FxRyE8zokBpKxQk9S4XUlfO7zfibkTjYw3wJ+91ezIyn2QFbQwsKfieHwUYVft QOkTZPmRPef5QaijdbkkpIE3Oir+admvKkAeiZJR/Tv3XZi2SFTjcgUgF5umTCCXLHoqJN 4JOZOlf3DWvz7lc7ULqET8Fcxas72sIX4ZBjBLO92nB93KHKSfxnGk8RTqPavuzf+WDbHs LsP9YIhr50e0P4EHt/ywwCbPMbYEma80PSx55xgLlT4+Bq7RSA/yiQDmGJgRbPQajrhTIe CLuM8jj0y1LW6NaVMvIG7ZWAg4XI9fSJ4+dS7nPI7XrpbQ1GNZzQxP0B7VWAeA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750855211; a=rsa-sha256; cv=none; b=s/39oswd5RYNMM4SVNTbAdFrDb02QD9ffRz2ICoLF8k5xgv8+MwNqnkB5tmwtdWWhzGlUh 8Ng4IrVWBcqmcJA+Uk2j4VF5hXL+TgnUWT9sLZxd/35j9lLh8yYt7u0r/mnuUyq72tV9Yo EfvpIGdLdEPmxokmqtzTCfxtiFbx8MVMERTNV0Qp5x7YFWVdPnkU3pbLJHKDSZiCuSE9eT dFALSXCcVxn6OcfeBEWLOQeQUj3v+Q7r37wUuDrtaVojvcBiuAgESdOypUy3SqRFEwRTHV HaFM1kuInNf3QPW4x2Obbq9TMgZAVW5I7Sq5VUNmVX4s11iFg/iAVjIrq4zgrg== 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 4bS1cV62Zrz2tN; Wed, 25 Jun 2025 12:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55PCeAMD039285; Wed, 25 Jun 2025 12:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55PCeAEC039276; Wed, 25 Jun 2025 12:40:10 GMT (envelope-from git) Date: Wed, 25 Jun 2025 12:40:10 GMT Message-Id: <202506251240.55PCeAEC039276@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 4981b8968d19 - main - libusb: consider bad fd as a broken event List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4981b8968d19f009347ee8844770e84f9b83311e Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4981b8968d19f009347ee8844770e84f9b83311e commit 4981b8968d19f009347ee8844770e84f9b83311e Author: SHENGYI HUNG AuthorDate: 2025-06-20 21:45:27 +0000 Commit: Baptiste Daroussin CommitDate: 2025-06-25 12:40:02 +0000 libusb: consider bad fd as a broken event Application can use libusb_get_pollfds to get pollfds from libusb then close the fd themselves. This cause the hotplug thread unable to leave because it will be consider as a invalid event then loop forever instead of a broken event that should be quit immediately. Reviewed by: bapt Sponsored by: FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50959 --- lib/libusb/libusb10_hotplug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libusb/libusb10_hotplug.c b/lib/libusb/libusb10_hotplug.c index f148e4dd43f5..369539d4512e 100644 --- a/lib/libusb/libusb10_hotplug.c +++ b/lib/libusb/libusb10_hotplug.c @@ -140,6 +140,8 @@ verify_event_validity(libusb_context *ctx) return (valid_event); return (invalid_event); } + if (errno == EBADF) + return (broken_event); return (invalid_event); } else if (ctx->usb_event_mode == usb_event_devd) { char buf[DEVCTL_MAXBUF];