From nobody Sun Feb 20 18:15:47 2022 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 4374E19CF946; Sun, 20 Feb 2022 18:15:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K1tsJ349vz4XhX; Sun, 20 Feb 2022 18:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645380948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a7vNTC6/D0+8Axq7jpHG/EBGBsf5UH/wexPEseCCIrM=; b=OxCLTv3IWj3LeSrRP8K5yDXGYrpNDs8BFHJ5NFsvXRNg72Y7bcKb7Drz4Au/aqgqKFRvzk sYD4/XwY/1Y5qup25fC2/Rcv49zQbgU0hnAjZn0Oq+YZNpYd5LaFQ6h6F7XV6NPApyFmCy PrDjngSYZDgJLnikuOM3WPigP+J2YgCA0zKPzj0BPF3RAN9dBXYycIBlfyRbHKM2ZchQ2U SG1QyyhZWuofLXVHM4XgakLoZiDqOHDlUvj53vBsV2RsRcQBqJCyW+TqzunBbdwcwmBFtD Su4HAyGM0vVo3/9PKDZYuHNAfZaHeZMN52DGYdpTPGfQeeB+OEAXsidtYQgmgg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C498D20DFA; Sun, 20 Feb 2022 18:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21KIFl9X023160; Sun, 20 Feb 2022 18:15:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21KIFlac023159; Sun, 20 Feb 2022 18:15:47 GMT (envelope-from git) Date: Sun, 20 Feb 2022 18:15:47 GMT Message-Id: <202202201815.21KIFlac023159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 8bc13d98db68 - stable/13 - LinuxKPI: 802.11 assign an(y) early chandef List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8bc13d98db68862df459dd00cb73a64cf776b21c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645380948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a7vNTC6/D0+8Axq7jpHG/EBGBsf5UH/wexPEseCCIrM=; b=rtMxKwAp0hcDrpF2aZ+W6ewuBjVpzC3V7N5fOG8Ycl5J5fvSia90sNwIxkvmzr62CJG6WX qHRSoDXC0XOcAQudnQ0yYxK18m1W4wfg+XcHj33juZqLgYdGIcEXnk/KFHQZxPLFBSkx9L 1OT6QJI5GWm0gUiWNPgQCU/pnQHMvjmz8miXepD1UU1FiSrh2CppWLzHpyc5odGX2/y9MA S8c3czzGF7F7d1cqqPeV8HxJzPI9lywnLwM2bU1KemKVkLYRnuhis/bkqXH07J3lXzp3V5 lk5LyJMRFrJgquAsw7t9/6akFVwhZ9TtRFzCCNE9I/q+jS9XfHNJugjKDP4x/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645380948; a=rsa-sha256; cv=none; b=h8IJXh7FuknsFGHK0u8YHsVym0H9AjqRP5K9/U0QxIOpuGaJ4MgaRgokdmwzdlkxK3Qy5u 67ir9CoiwyGkPwyU8RkCgqrU0vdBCHjHA8RZkLyqXfRUx8N98hNNZuw9eSS2XNtMQ7qc1j tLmOhn4Gk66VhCKJLhQgdx7lPg21YDE3DWQTNN3Ps7hCz9Jt25lPMRRWFeZFMnBHvIZs3M 8h7ur0SacUJ9exVOWA8FpdwX9wF30JuLrQAwxXu4Dfpy3CFhQeog9aaSit8S37qPMXzv3p H8eh20OFO+FNJTn8aosZAem9ohWQYioBDTTV1mwet9hWyLT+xBYxixWYODJr1Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=8bc13d98db68862df459dd00cb73a64cf776b21c commit 8bc13d98db68862df459dd00cb73a64cf776b21c Author: Bjoern A. Zeeb AuthorDate: 2022-02-16 03:48:54 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-02-20 16:25:25 +0000 LinuxKPI: 802.11 assign an(y) early chandef The Realtek driver assumes an early chandef to be set. At the time of linuxkpi_ieee80211_ifattach() we do not really know one yet so try to find the first one which is available and set that. This prevents a NULL-deref panic. (cherry picked from commit c5b96b3eaede01a5117975af6de3483dc43673a4) --- sys/compat/linuxkpi/common/src/linux_80211.c | 32 +++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 473c98317694..fb113d770678 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2818,9 +2818,7 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) { struct ieee80211com *ic; struct lkpi_hw *lhw; -#ifdef TRY_HW_CRYPTO - int i; -#endif + int band, i; lhw = HW_TO_LHW(hw); ic = lhw->ic; @@ -2919,6 +2917,34 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) lkpi_radiotap_attach(lhw); + /* + * Assign the first possible channel for now; seems Realtek drivers + * expect one. + */ + for (band = 0; band < NUM_NL80211_BANDS && + hw->conf.chandef.chan == NULL; band++) { + struct ieee80211_supported_band *supband; + struct linuxkpi_ieee80211_channel *channels; + + supband = hw->wiphy->bands[band]; + if (supband == NULL || supband->n_channels == 0) + continue; + + channels = supband->channels; + for (i = 0; i < supband->n_channels; i++) { + struct cfg80211_chan_def chandef; + + if (channels[i].flags & IEEE80211_CHAN_DISABLED) + continue; + + memset(&chandef, 0, sizeof(chandef)); + cfg80211_chandef_create(&chandef, &channels[i], + NL80211_CHAN_NO_HT); + hw->conf.chandef = chandef; + break; + } + } + if (bootverbose) ieee80211_announce(ic); }