From owner-svn-src-stable@freebsd.org Mon Mar 12 08:52:36 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1825F2C88B for ; Mon, 12 Mar 2018 08:52:35 +0000 (UTC) (envelope-from oliver.pinter@balabit.com) Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 094A9700A1 for ; Mon, 12 Mar 2018 08:52:34 +0000 (UTC) (envelope-from oliver.pinter@balabit.com) Received: by mail-io0-x243.google.com with SMTP id m22so10466870iob.12 for ; Mon, 12 Mar 2018 01:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=balabit-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=embZVTQmaUUgc8ErBXF0L0lBrlfVLy6qYpa785Oo35c=; b=fjr9ChRAuJz5NRn1P9qjmbKJzw0j26DeTSQJTpLkKrfC3AE9isaeQTAHwg65xHH450 /4jZtNWli0P9A9JKfj/PDiwWDJn8tI9RaUOr3JgTdDgCmMjhth/USiyTyBwhqacqJB+i e2kf1C330DRu86s4cfKRicwaQEVmCqQWOTij6eN//y2JM72QVr3b10+Vw7eczCamB9Cf FVh9u7GCYlIsIYXnWf/IofYks6THQSY/2Dq4MVbIL1BIHH82UbC/WHVt97dREO8gjeg5 L3/+ihSG12ol96F4C9HqbPHJqyc2deepMc7TWeVb/NgLzf3bcijEc/JZZib2fEIf7OB/ LTpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=embZVTQmaUUgc8ErBXF0L0lBrlfVLy6qYpa785Oo35c=; b=Gg9CR7KKyOBDbDRsn63IHtxq3aGjoaOlK6SE4rFy9Explg/csOHuLcwZ/A4O1IBjqS /ODQjmQ9OugmrQXG+khjfydLlcBMNAreCmlHbbo8otuvLWGKKYyokfGwwPsWhLRIvzlH mUfeggDOi0bI6mua9EUgjWzoKZK71lL6YwC11dt75pKHOwo1YiAgtLlRYFFbY8OyxBTT 4PaV2MX3sTuNfSdG/vj6HefPzD3lq9kJGbCnogNwnEebvqBdlCLuUE/QiQ3nvqGxw/wm x8zFOAC27HxVtqhE29Un6k3EHPzbSIFNzQBJMXV/4IEM8R4BQlNkb6MnZAmlKXn2gGWn /JYA== X-Gm-Message-State: AElRT7H+cabuDzupSyyP+s8u2eoD9B6rNjxSKaWNTmW22fSbUM4vNgy0 lPz77qwEwZLTLvGM7ltI6jBHb7yLpE4fZoyovc+h/Q== X-Google-Smtp-Source: AG47ELvaKs/WH1JyJtap9Oiw+s9aQM6ixnXKqWUz70Jg2FWBBQnARyVC4PVS4QJ7kXVjKbnikCREoC3tIIxdYvqg2YQ= X-Received: by 10.107.48.3 with SMTP id w3mr7807269iow.84.1520844754324; Mon, 12 Mar 2018 01:52:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.192.225.141 with HTTP; Mon, 12 Mar 2018 01:52:33 -0700 (PDT) In-Reply-To: <201803112249.w2BMnkwJ044355@repo.freebsd.org> References: <201803112249.w2BMnkwJ044355@repo.freebsd.org> From: =?UTF-8?B?UGludMOpciwgT2xpdsOpcg==?= Date: Mon, 12 Mar 2018 09:52:33 +0100 Message-ID: Subject: Re: svn commit: r330784 - stable/11/sys/dev/iwm To: Eitan Adler Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Mar 2018 08:52:36 -0000 On Sun, Mar 11, 2018 at 11:49 PM, Eitan Adler wrote: > Author: eadler > Date: Sun Mar 11 22:49:46 2018 > New Revision: 330784 > URL: https://svnweb.freebsd.org/changeset/base/330784 > > Log: > Revert r324434 > Wrong revision here^ based on this: https://svnweb.freebsd.org/base?view=revision&revision=324434 > > Some users are reporting that it is causing issues for their hardware. > In the interest of not breaking stable, revert while we investigate. > > Modified: > stable/11/sys/dev/iwm/if_iwm.c > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/sys/dev/iwm/if_iwm.c > ============================================================ > ================== > --- stable/11/sys/dev/iwm/if_iwm.c Sun Mar 11 20:13:15 2018 > (r330783) > +++ stable/11/sys/dev/iwm/if_iwm.c Sun Mar 11 22:49:46 2018 > (r330784) > @@ -547,14 +547,12 @@ iwm_read_firmware(struct iwm_softc *sc, enum > iwm_ucode > { > struct iwm_fw_info *fw = &sc->sc_fw; > const struct iwm_tlv_ucode_header *uhdr; > - const struct iwm_ucode_tlv *tlv; > + struct iwm_ucode_tlv tlv; > struct iwm_ucode_capabilities *capa = &sc->ucode_capa; > enum iwm_ucode_tlv_type tlv_type; > const struct firmware *fwp; > const uint8_t *data; > - uint32_t tlv_len; > uint32_t usniffer_img; > - const uint8_t *tlv_data; > uint32_t paging_mem_size; > int num_of_cpus; > int error = 0; > @@ -607,21 +605,25 @@ iwm_read_firmware(struct iwm_softc *sc, enum > iwm_ucode > goto out; > } > > - snprintf(sc->sc_fwver, sizeof(sc->sc_fwver), "%u.%u (API ver %u)", > + snprintf(sc->sc_fwver, sizeof(sc->sc_fwver), "%d.%d (API ver %d)", > IWM_UCODE_MAJOR(le32toh(uhdr->ver)), > IWM_UCODE_MINOR(le32toh(uhdr->ver)), > IWM_UCODE_API(le32toh(uhdr->ver))); > data = uhdr->data; > len = fw->fw_fp->datasize - sizeof(*uhdr); > > - while (len >= sizeof(*tlv)) { > - len -= sizeof(*tlv); > - tlv = (const void *)data; > + while (len >= sizeof(tlv)) { > + size_t tlv_len; > + const void *tlv_data; > > - tlv_len = le32toh(tlv->length); > - tlv_type = le32toh(tlv->type); > - tlv_data = tlv->data; > + memcpy(&tlv, data, sizeof(tlv)); > + tlv_len = le32toh(tlv.length); > + tlv_type = le32toh(tlv.type); > > + len -= sizeof(tlv); > + data += sizeof(tlv); > + tlv_data = data; > + > if (len < tlv_len) { > device_printf(sc->sc_dev, > "firmware too short: %zu bytes\n", > @@ -629,21 +631,19 @@ iwm_read_firmware(struct iwm_softc *sc, enum > iwm_ucode > error = EINVAL; > goto parse_out; > } > - len -= roundup2(tlv_len, 4); > - data += sizeof(tlv) + roundup2(tlv_len, 4); > > switch ((int)tlv_type) { > case IWM_UCODE_TLV_PROBE_MAX_LEN: > - if (tlv_len != sizeof(uint32_t)) { > + if (tlv_len < sizeof(uint32_t)) { > device_printf(sc->sc_dev, > - "%s: PROBE_MAX_LEN (%d) != > sizeof(uint32_t)\n", > + "%s: PROBE_MAX_LEN (%d) < > sizeof(uint32_t)\n", > __func__, > (int) tlv_len); > error = EINVAL; > goto parse_out; > } > capa->max_probe_length = > - le32_to_cpup((const uint32_t *)tlv_data); > + le32toh(*(const uint32_t *)tlv_data); > /* limit it to something sensible */ > if (capa->max_probe_length > > IWM_SCAN_OFFLOAD_PROBE_REQ_SIZE) { > @@ -674,14 +674,6 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode > error = EINVAL; > goto parse_out; > } > - if (tlv_len % sizeof(uint32_t)) { > - device_printf(sc->sc_dev, > - "%s: IWM_UCODE_TLV_FLAGS: tlv_len (%d) > %% sizeof(uint32_t)\n", > - __func__, > - (int) tlv_len); > - error = EINVAL; > - goto parse_out; > - } > /* > * Apparently there can be many flags, but Linux > driver > * parses only the first one, and so do we. > @@ -693,7 +685,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode > * 2) TLV_FLAGS contains TLV_FLAGS_PAN > * ==> this resets TLV_PAN to itself... hnnnk > */ > - capa->flags = le32_to_cpup((const uint32_t > *)tlv_data); > + capa->flags = le32toh(*(const uint32_t *)tlv_data); > break; > case IWM_UCODE_TLV_CSCHEME: > if ((error = iwm_store_cscheme(sc, > @@ -714,7 +706,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode > error = EINVAL; > goto parse_out; > } > - num_of_cpus = le32_to_cpup((const uint32_t > *)tlv_data); > + num_of_cpus = le32toh(*(const uint32_t *)tlv_data); > if (num_of_cpus == 2) { > fw->fw_sects[IWM_UCODE_REGULAR].is_dual_cpus > = > TRUE; > @@ -788,7 +780,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode > goto parse_out; > } > sc->sc_fw.phy_config = > - le32_to_cpup((const uint32_t *)tlv_data); > + le32toh(*(const uint32_t *)tlv_data); > sc->sc_fw.valid_tx_ant = (sc->sc_fw.phy_config & > IWM_FW_PHY_CFG_TX_CHAIN) > >> > > IWM_FW_PHY_CFG_TX_CHAIN_POS; > @@ -839,7 +831,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode > error = EINVAL; > goto parse_out; > } > - paging_mem_size = le32_to_cpup((const uint32_t > *)tlv_data); > + paging_mem_size = le32toh(*(const uint32_t > *)tlv_data); > > IWM_DPRINTF(sc, IWM_DEBUG_FIRMWARE_TLV, > "%s: Paging: paging enabled (size = %u > bytes)\n", > @@ -872,7 +864,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode > goto parse_out; > } > capa->n_scan_channels = > - le32_to_cpup((const uint32_t *)tlv_data); > + le32toh(*(const uint32_t *)tlv_data); > break; > > case IWM_UCODE_TLV_FW_VERSION: > @@ -897,6 +889,9 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode > error = EINVAL; > goto parse_out; > } > + > + len -= roundup(tlv_len, 4); > + data += roundup(tlv_len, 4); > } > > KASSERT(error == 0, ("unhandled error")); > _______________________________________________ > svn-src-stable-11@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-stable-11 > To unsubscribe, send any mail to "svn-src-stable-11- > unsubscribe@freebsd.org" >