From: stsp Date: Sun, 18 Jul 2021 11:56:11 +0000 (+0000) Subject: Fix wrong usage of iwx_lookup_cmd_ver() in iwx_send_soc_conf(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e95726c9bac0fcd7326797523ed7ef4bc1c270e6;p=openbsd Fix wrong usage of iwx_lookup_cmd_ver() in iwx_send_soc_conf(). Callers are supposed to check whether iwx_lookup_cmd_ver() returns CMD_VER_UNKNOWN, and this check was missing here. Fortunately, the buggy check was part of a condition which also requires the low_latency_xtal constant to be set. We do not yet support devices where low_latency_xtal is non-zero, so the bug never triggered. --- diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index 406042ab42f..cd019fc4890 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.64 2021/07/18 11:40:31 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.65 2021/07/18 11:56:11 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -7201,7 +7201,8 @@ iwx_send_soc_conf(struct iwx_softc *sc) IWX_SOC_FLAGS_LTR_APPLY_DELAY_MASK); scan_cmd_ver = iwx_lookup_cmd_ver(sc, IWX_LONG_GROUP, IWX_SCAN_REQ_UMAC); - if (scan_cmd_ver >= 2 && sc->sc_low_latency_xtal) + if (scan_cmd_ver != IWX_FW_CMD_VER_UNKNOWN && + scan_cmd_ver >= 2 && sc->sc_low_latency_xtal) flags |= IWX_SOC_CONFIG_CMD_FLAGS_LOW_LATENCY; } cmd.flags = htole32(flags);