diff options
| author | yuvrajnode <yuvrajsinghrock1221@gmail.com> | 2026-08-23 07:15:49 +0000 |
|---|---|---|
| committer | ShengYi Hung <aokblast@FreeBSD.org> | 2026-08-24 01:29:52 +0000 |
| commit | 1c2263b683977ebab3d9a6448268ad810ceeec70 (patch) | |
| tree | 4c9baa46d3f56c0aabf52c2a672ea74a9ea9c624 /lib/DebugInfo/CodeView/(developers-only) | |
| parent | fc3e8434a61f372b4d6ec6bd8910ac8cd54b9b37 (diff) | |
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 <yuvrajsinghrock1221@gmail.com>
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
Diffstat (limited to 'lib/DebugInfo/CodeView/(developers-only)')
0 files changed, 0 insertions, 0 deletions
