From nobody Tue Dec 16 04:35:53 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 572CFC433FE for ; Thu, 13 Oct 2022 17:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230114AbiJMRzu (ORCPT ); Thu, 13 Oct 2022 13:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbiJMRyv (ORCPT ); Thu, 13 Oct 2022 13:54:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 113C015B331; Thu, 13 Oct 2022 10:54:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EDF5EB8201E; Thu, 13 Oct 2022 17:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BF0FC4314A; Thu, 13 Oct 2022 17:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665683638; bh=sSqsu/k7yCRo955wozzFH4QiJ3MfdL8o3wAU2EqhNQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cpDXaARaAKdpMcESmUg2Ys2A4dqGbT0nS9wsTNBH7/r7PNDw+k/LgTxNq4nPC/K6Y fsWwYhI2cPlS1oTk8xSwP92Hlxd9B6+9jmTd6D84BstbnV9yo75WALu0UWScOXHIRE 9gjV6N0Veny6lEN3STF06wl5dyEw9sh/TfRv7iSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?S=C3=B6nke=20Huster?= , Johannes Berg Subject: [PATCH 5.4 36/38] wifi: cfg80211: update hidden BSSes to avoid WARN_ON Date: Thu, 13 Oct 2022 19:52:37 +0200 Message-Id: <20221013175145.450004794@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175144.245431424@linuxfoundation.org> References: <20221013175144.245431424@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg commit c90b93b5b782891ebfda49d4e5da36632fefd5d1 upstream. When updating beacon elements in a non-transmitted BSS, also update the hidden sub-entries to the same beacon elements, so that a future update through other paths won't trigger a WARN_ON(). The warning is triggered because the beacon elements in the hidden BSSes that are children of the BSS should always be the same as in the parent. Reported-by: S=C3=B6nke Huster Tested-by: S=C3=B6nke Huster Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in sc= anning") Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/scan.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -1099,6 +1099,23 @@ struct cfg80211_non_tx_bss { u8 bssid_index; }; =20 +static void cfg80211_update_hidden_bsses(struct cfg80211_internal_bss *kno= wn, + const struct cfg80211_bss_ies *new_ies, + const struct cfg80211_bss_ies *old_ies) +{ + struct cfg80211_internal_bss *bss; + + /* Assign beacon IEs to all sub entries */ + list_for_each_entry(bss, &known->hidden_list, hidden_list) { + const struct cfg80211_bss_ies *ies; + + ies =3D rcu_access_pointer(bss->pub.beacon_ies); + WARN_ON(ies !=3D old_ies); + + rcu_assign_pointer(bss->pub.beacon_ies, new_ies); + } +} + static bool cfg80211_update_known_bss(struct cfg80211_registered_device *rdev, struct cfg80211_internal_bss *known, @@ -1122,7 +1139,6 @@ cfg80211_update_known_bss(struct cfg8021 kfree_rcu((struct cfg80211_bss_ies *)old, rcu_head); } else if (rcu_access_pointer(new->pub.beacon_ies)) { const struct cfg80211_bss_ies *old; - struct cfg80211_internal_bss *bss; =20 if (known->pub.hidden_beacon_bss && !list_empty(&known->hidden_list)) { @@ -1150,16 +1166,7 @@ cfg80211_update_known_bss(struct cfg8021 if (old =3D=3D rcu_access_pointer(known->pub.ies)) rcu_assign_pointer(known->pub.ies, new->pub.beacon_ies); =20 - /* Assign beacon IEs to all sub entries */ - list_for_each_entry(bss, &known->hidden_list, hidden_list) { - const struct cfg80211_bss_ies *ies; - - ies =3D rcu_access_pointer(bss->pub.beacon_ies); - WARN_ON(ies !=3D old); - - rcu_assign_pointer(bss->pub.beacon_ies, - new->pub.beacon_ies); - } + cfg80211_update_hidden_bsses(known, new->pub.beacon_ies, old); =20 if (old) kfree_rcu((struct cfg80211_bss_ies *)old, rcu_head); @@ -1798,6 +1805,8 @@ cfg80211_update_notlisted_nontrans(struc } else { old =3D rcu_access_pointer(nontrans_bss->beacon_ies); rcu_assign_pointer(nontrans_bss->beacon_ies, new_ies); + cfg80211_update_hidden_bsses(bss_from_pub(nontrans_bss), + new_ies, old); rcu_assign_pointer(nontrans_bss->ies, new_ies); if (old) kfree_rcu((struct cfg80211_bss_ies *)old, rcu_head);