From nobody Wed Feb 16 03:51:20 2022 X-Original-To: dev-commits-src-main@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 B385D19A2949; Wed, 16 Feb 2022 03:51:20 +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 4Jz3sh4gFxz3Hph; Wed, 16 Feb 2022 03:51:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644983480; 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=fDOKr8GFviCGnQlZuHAPiTuF9l9Rf7eP60Q0N/V/MXs=; b=TjzZF5of6hZbAcQi9bkt0ih+7c2ymA0986RZs88kcZ2quIi20z+PM3Eg7zUIEXAtoyjpXT 9TCsrswfay2Ak9fY3J3XGf5UnlLVoaU2lFDMKUIvxuRtinROzn/p1vwUggCXCYgU0UsJKA 1X8HWV3OQyqBdvKF8b3yvvJvWqO4k14610gkOne1atdb+ZzPrLX7ZtTf/5UMuAibFmW79T utzFD54HTrnesSMjHgFsyTLn5zCP7tcPzbWt7vDlKQmzPyDyWaErV7MzgoIT6T3DTLcbfG icz7j2Qj5ruX9HHpNAEpqzOtaAdjbQTMS7fE0ohRQMT0t6WOwGr/J1maFFjAkg== 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 800226EC7; Wed, 16 Feb 2022 03:51:20 +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 21G3pKtO025346; Wed, 16 Feb 2022 03:51:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21G3pKEV025345; Wed, 16 Feb 2022 03:51:20 GMT (envelope-from git) Date: Wed, 16 Feb 2022 03:51:20 GMT Message-Id: <202202160351.21G3pKEV025345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c5b96b3eaede - main - LinuxKPI: 802.11 assign an(y) early chandef List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c5b96b3eaede01a5117975af6de3483dc43673a4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644983480; 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=fDOKr8GFviCGnQlZuHAPiTuF9l9Rf7eP60Q0N/V/MXs=; b=aZvnLNjVOIFG5/zLrgxw0KGw1n/9xPrG0shUr/6UAJso+VUTnn6GPeWRrhiXh8C9KMj3MP zN8H9l0HAgXD0lqn8apff039vkMKuMsoqgdmeNdw3HXl39Zf2u/MpL3mv5pJMxlCAwg3Z6 V4M9yjZh9G7Lwjw6HH33rN0HiWshhlQn6PNIAPCoGYzxQPVK+pvwagcv3YcDmS8ON8ePWg nZUgwjZMZ0gsfuly+rlcKlz1Y+6o2pGk2asnIAFX8kChofeodBWZihVfZsfrEAALsCOF5M ZcrhGmyBTO4pZxm3qiAGrjGeqoAJkAnVDq0gKU8JA/k0mm01mboKCnIOscHpag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644983480; a=rsa-sha256; cv=none; b=UM4d25NIDQgh+ChpHe11r+2zEhSQv2LhK3o1JN8A4x6LQzpFXMfyclQ9gS+IMmTiUyRKh4 gCds7+LOvMxtHPVpin1RhYWAcqRWDsN2bTISOtAYK8iT10tO9V0F9XMxgW1NWSr5Vc0D3m riqJb6VB49eSRYYTFQA0/Dx+qwig4N0MsGrAVX2hstnGlcub+Ot0TycfSqrwPV0lPFrM4I HzGDu9mpCqCuB8Bc5A3e5z7PH62IqNY6+jL4n47BgmO3fEab8+41cWyX7da+OrNy+/0f50 g8f9yEafV5mkO9O8d+18Tv1r/aV1+j4ygB8/ObLK4XCNYAiIFq7OvB03ITiH9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c5b96b3eaede01a5117975af6de3483dc43673a4 commit c5b96b3eaede01a5117975af6de3483dc43673a4 Author: Bjoern A. Zeeb AuthorDate: 2022-02-16 03:48:54 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-02-16 03:48:54 +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. MFC after: 3 days --- 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 1bed7de0c454..5267cbf385c0 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2830,9 +2830,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; @@ -2936,6 +2934,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);