From nobody Sun Nov 01 12:20:22 2026 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 4jHYnk353kz6yB1N for ; Sun, 01 Nov 2026 12:20:26 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2001:41d0:700:4a43:a25:de0:0:13]) (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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jHYnj4fQBz4JN4; Sun, 01 Nov 2026 12:20:25 +0000 (UTC) (envelope-from freebsd@omnilan.de) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@omnilan.de designates 2001:41d0:700:4a43:a25:de0:0:13 as permitted sender) smtp.mailfrom=freebsd@omnilan.de Received: from mh0.gentlemail.de (mh0.gentlemail.de [135.125.173.218]) by mx0.gentlemail.de (8.18.1/8.18.1) with ESMTP id 6A1CKN5K043852; Sun, 1 Nov 2026 12:20:23 GMT (envelope-from freebsd@omnilan.de) Received: from [172.21.35.3] (s1.omnilan.de [217.91.127.234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id 560E31AE86; Sun, 01 Nov 2026 12:20:23 +0000 (UTC) Message-ID: Date: Sun, 1 Nov 2026 13:20:22 +0100 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: git: 1c2263b68397 - main - libusb: Validate arguments before dereferencing the hotplug context To: ShengYi Hung , dev-commits-src-all@FreeBSD.org Cc: yuvrajnode References: <6a8b9e9b.3615a.68f2c82f@gitrepo.freebsd.org> Content-Language: en-US, de-DE From: Harry Schmalzbauer Organization: OmniLAN In-Reply-To: <6a8b9e9b.3615a.68f2c82f@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4jHYnj4fQBz4JN4 X-Spamd-Bar: / X-Spamd-Result: default: False [-0.30 / 15.00]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FREEMAIL_CC(0.00)[gmail.com]; ARC_NA(0.00)[]; HAS_ORG_HEADER(0.00)[]; ASN(0.00)[asn:16276, ipnet:2001:41d0::/32, country:FR]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-all@FreeBSD.org]; DMARC_NA(0.00)[omnilan.de]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DNSWL_BLOCKED(0.00)[217.91.127.234:received]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_THREE(0.00)[3] On 2026-08-24 03:30, ShengYi Hung wrote: > The branch main has been updated by aokblast: > > URL: https://cgit.FreeBSD.org/src/commit/?id=1c2263b683977ebab3d9a6448268ad810ceeec70 > > commit 1c2263b683977ebab3d9a6448268ad810ceeec70 > Author: yuvrajnode > AuthorDate: 2026-08-23 07:15:49 +0000 > Commit: ShengYi Hung > CommitDate: 2026-08-24 01:29:52 +0000 > > libusb: Validate arguments before dereferencing the hotplug context > > libusb_hotplug_register_callback() resolves its context with > GET_CONTEXT() and then immediately reads ctx->no_discovery and > ctx->usb_event_mode, but only checks "ctx == NULL" afterwards. > > GET_CONTEXT() falls back to usbi_default_context, which is NULL before > libusb_init() and is reset to NULL by libusb_exit(). An application > that calls libusb_hotplug_register_callback(NULL, ...) without an > initialised default context therefore crashes on the ctx->no_discovery > read, instead of getting the LIBUSB_ERROR_INVALID_PARAM the existing > guard was clearly written to return. > > Move the argument validation ahead of the first dereference. None of > the validated arguments depend on the context, so no other ordering > constraint is affected. > > Signed-off-by: yuvrajnode > Reviewed by: aokblast > MFC after: 2 weeks > Pull Request: https://github.com/freebsd/freebsd-src/pull/2384 > Closes: https://github.com/freebsd/freebsd-src/pull/2384 > --- Hello, do you still plan to MFC this (1c2263b68397 - main - libusb: Validate arguments before dereferencing the hotplug context)? I guess these might be valuable MFC candidates too: 2879c818e553 - main - libusb: implement libusb_set_option 6bda9f26d2ed - main - libusb: change callback register handler to int fc3e8434a61f - main - libusb: Fix NULL dereference when a hotplug callback deregisters itself Probably Ed's too? 250db717b24d libusb: Add an XXX comment for possible duplicate callback IDs a793cabb621e libusb: Avoid signed integer overflow UB Thanks, -harry