From patchwork Thu Oct 13 17:53:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 2279 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp424235wrs; Thu, 13 Oct 2022 11:40:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4inNd6i0+iyx/CeCCkv6wC7+eCAWNq2kKipNQdtisaxWhux/j8XyTN062RskQ8w2nAP6Nd X-Received: by 2002:a62:2985:0:b0:544:77d4:f43b with SMTP id p127-20020a622985000000b0054477d4f43bmr896012pfp.9.1665686455497; Thu, 13 Oct 2022 11:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665686455; cv=none; d=google.com; s=arc-20160816; b=N5bwnngPpZtwHu3F0MFxXFdr5KXNTODi6wPbQ89sqap1h/0LHStWiL72Apeg6tKMzY QkKJV465sd3YF0LjYOMLvbiJLwhsrD+J6irlSTB13OZGhJth0xzIIoKYHmNIo0xsb7Pu KBrbWw1ztA77LfBuOl87kk5f0MfZRLP0nwbASsCAf9c3x5X9n9fTEybM8jgYdnKoCRkO 7L0l3oTogqIpuTcL75SFHCCfJq5aJvb582i4P7cVMcX0bblyPkEZZtCxCa3rgJTxM9Zp xHFHXjBSGs2m7WJ9C3gKh4WT2S8R7KOFALmYd/I2as+1pczWKscmN4YNM4I94fFLoO4c oFEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tuNFlO5xEwx1qwA17FlNfOiBU373yUDD5hY9sp6BMwM=; b=iOKPvlPId2ra4vqK/npexLXgShFUv1AxBGCKRGupRWpxJC/wB5D7Ae3wAUQEQ1dulA TEEERLOVCtTHwweVQFL9SoU/W+cMSIO96p9PEPrr7vkOmuTLUApcWtswiq7sHBvc0/kH ohTm9GPWVNs34/EKeDv5bMj2am9wUkILvGOE4zil5xyetHUJ+xIfAdvHzsN3qIwG2x2Z qM5o63AOdUY4V64d0bl7eVf9zOkdrKICAM8RtkcEtdF2pd+wjgIgWIO9JUAsrSDrXHxz BurIW+GohEB9hPI6BKOjKoPKbWsgBq0horPBQDAzRv0n3EZq5UiNc/Vg+AagCewrYEDM NJ0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="hJh/MGzy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a170903211500b0016c00834dd5si482555ple.18.2022.10.13.11.40.42; Thu, 13 Oct 2022 11:40:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="hJh/MGzy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231865AbiJMSQj (ORCPT + 99 others); Thu, 13 Oct 2022 14:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232271AbiJMSOe (ORCPT ); Thu, 13 Oct 2022 14:14:34 -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 3DCBF170DF0; Thu, 13 Oct 2022 11:10:58 -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 5383EB820AD; Thu, 13 Oct 2022 18:01:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B547EC433D6; Thu, 13 Oct 2022 18:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1665684113; bh=YcQbhCSPoD2UnDkliHAi/oE6U9WmvVTA8st+VYyO1o0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hJh/MGzykUe+e46qb8pFPWngN3MsgCCNeynk0EX2OqNcKO23Tgu1p2CVFfPosG+h8 DIYDyyGyab3Dv3EE5M9FlsIeRmOV7kU5r3DJgV4iWO3BiflVcKlbiBiMR47DNmLBh7 x4VKOPEosJ742+eOzkpyjHgja38GrXpml6zmYRCA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?S=C3=B6nke_Huster?= , Johannes Berg Subject: [PATCH 6.0 29/34] wifi: cfg80211: update hidden BSSes to avoid WARN_ON Date: Thu, 13 Oct 2022 19:53:07 +0200 Message-Id: <20221013175147.267608492@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013175146.507746257@linuxfoundation.org> References: <20221013175146.507746257@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746598840579923627?= X-GMAIL-MSGID: =?utf-8?q?1746598840579923627?= 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önke Huster Tested-by: Sönke Huster Fixes: 0b8fb8235be8 ("cfg80211: Parsing of Multiple BSSID information in scanning") 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 @@ -1607,6 +1607,23 @@ struct cfg80211_non_tx_bss { u8 bssid_index; }; +static void cfg80211_update_hidden_bsses(struct cfg80211_internal_bss *known, + 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 = rcu_access_pointer(bss->pub.beacon_ies); + WARN_ON(ies != 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, @@ -1630,7 +1647,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; if (known->pub.hidden_beacon_bss && !list_empty(&known->hidden_list)) { @@ -1658,16 +1674,7 @@ cfg80211_update_known_bss(struct cfg8021 if (old == rcu_access_pointer(known->pub.ies)) rcu_assign_pointer(known->pub.ies, new->pub.beacon_ies); - /* Assign beacon IEs to all sub entries */ - list_for_each_entry(bss, &known->hidden_list, hidden_list) { - const struct cfg80211_bss_ies *ies; - - ies = rcu_access_pointer(bss->pub.beacon_ies); - WARN_ON(ies != old); - - rcu_assign_pointer(bss->pub.beacon_ies, - new->pub.beacon_ies); - } + cfg80211_update_hidden_bsses(known, new->pub.beacon_ies, old); if (old) kfree_rcu((struct cfg80211_bss_ies *)old, rcu_head); @@ -2360,6 +2367,8 @@ cfg80211_update_notlisted_nontrans(struc } else { old = 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);