The branch main has been updated by aokblast: URL: https://cgit.FreeBSD.org/src/commit/?id=228b1a011660ee1005bc4ab7c97113af8d87fe5c
commit 228b1a011660ee1005bc4ab7c97113af8d87fe5c Author: ShengYi Hung <[email protected]> AuthorDate: 2026-09-26 06:42:39 +0000 Commit: ShengYi Hung <[email protected]> CommitDate: 2026-09-26 06:45:08 +0000 uchcom: Set rate to 1 if 0 If userspace provides rate == 0, it causes kernel panic as rate is directly used as a divident, which cannot be zero. Fix it by set the rate to 1 if it is passed as 0. Reviewed by: imp, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59111 --- sys/dev/usb/serial/uchcom.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c index ff1ac8897c90..d315b2d37c46 100644 --- a/sys/dev/usb/serial/uchcom.c +++ b/sys/dev/usb/serial/uchcom.c @@ -628,6 +628,9 @@ uchcom_calc_baudrate(struct uchcom_softc *sc, uint32_t rate, uint8_t *divisor, *divisor = 0; } + if (rate == 0) + rate = 1; + *factor = 256 - clk / rate; if (rate == 921600 && sc->sc_chiptype != TYPE_CH343) {
