From patchwork Wed Oct 19 08:25:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4652 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212487wrs; Wed, 19 Oct 2022 02:07:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Jf9AAtF7PLvShlmrx87XsIGhk1KlAKhNXpzBkHc4Jdv07jK7EgrMW1nL01R96ZA6oaMDN X-Received: by 2002:a05:6a00:994:b0:562:f5fe:9024 with SMTP id u20-20020a056a00099400b00562f5fe9024mr7721165pfg.12.1666170458045; Wed, 19 Oct 2022 02:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170458; cv=none; d=google.com; s=arc-20160816; b=jfF7XHp5AUSRJg9u2RVJdcfgb8mDviQAIdhFFUZbrKTZcAZiLI6ImqsYu8z5LiRcKf R89XH7Y0hi6H1FCl6VbBu2MTcRrZ0Ahm8FsCM4nviwDPR2sr6DsYi37RlIva9+KIsncm D4nPio0TF8MIPmbydFlsw1HMIK1S7uXurSwMFf+O2KK6Gcuxmb1A28jSHUAUrClSkUW/ xGVQlnCDEz53txFoc30rsGi7XZ3heaQ7dJX3lDjxNnSuDiKj2u8UjSYwEheXJplLjOow I0p83a+7yztGN3M9aaDkzxHcHs/6JowOaJ9MfYar+ig+TetDqaQ98srjeRB87L080f93 HtiQ== 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=g5lWdp1FDqfkRM7E5WwfG0gxADPXJfElQwwaWqYwRgw=; b=0nFtEv5Rb6H/X/zf6VPjQj/LkHUT8yWjfJOZhzIxMbTvgEACSCa5VOiWLmu7HbW6ux r8C98ZVNz93x5ajFUHaDP5L/xkYxJx4GwE+RRBQZm9LD5YNWkkyaKeiAZd5igJkzgcLp JZVkjrfvAo5S2DIlSbqP7HOQiHNLOfNxHbzvLwN7aEw0NzL+aEhb5rRakG5b63zc6ZPQ Yy632eFqKML7WelfDnMPqM5k/lrgX3g0p2+lbik3d9/Wr1xUTR5GmjCWi3IgQDggXzVj coCoWBjqMUtmG4hJu32hT/oI2PBZsKn/26bNuAtxrgT/ct5FzCh3E4lQy1XSOs3piYth 5cpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pwCHRqCq; 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 n8-20020a170902f60800b001786b70f913si17922937plg.164.2022.10.19.02.07.20; Wed, 19 Oct 2022 02:07:38 -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=pwCHRqCq; 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 S232012AbiJSI5c (ORCPT + 99 others); Wed, 19 Oct 2022 04:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231894AbiJSI4j (ORCPT ); Wed, 19 Oct 2022 04:56:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF1A175A2; Wed, 19 Oct 2022 01:52:44 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 0730D617D4; Wed, 19 Oct 2022 08:49:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C30FC433D6; Wed, 19 Oct 2022 08:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169344; bh=CDZp1MYri+orB59jg/D8jxZWD0sMczQ9N3voVKdnd0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwCHRqCqLLKX9lumbpz42T63VWdx7ULwU1xp0HNjhAXZ49lozdhktu9Sascii5Id7 lF36GbWebhYwxs2jqCFGfdLWTe2M5ZrYlcW6QqtTyWjcMW2jI4Noc4OboFfrbQTF5v yqGs+YXSGT0+l7H/WHkM36tOoo/tDsvREwSWBWac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 6.0 242/862] wifi: mac80211_hwsim: fix link change handling Date: Wed, 19 Oct 2022 10:25:29 +0200 Message-Id: <20221019083300.705612740@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747106354273170132?= X-GMAIL-MSGID: =?utf-8?q?1747106354273170132?= From: Johannes Berg [ Upstream commit 65f7052b6c38f767d95ebfa4ae4b389b6da6a421 ] The code for determining which links to update in wmediumd or virtio was wrong, fix it to remove the deflink only if there were no old links, and also add the deflink if there are no other new links. Fixes: c204d9df0202 ("wifi: mac80211_hwsim: handle links for wmediumd/virtio") Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/mac80211_hwsim.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index ee34814bd12b..a074552bcec3 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2995,10 +2995,15 @@ static int mac80211_hwsim_change_vif_links(struct ieee80211_hw *hw, u16 old_links, u16 new_links, struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]) { - unsigned long rem = old_links & ~new_links ?: BIT(0); + unsigned long rem = old_links & ~new_links; unsigned long add = new_links & ~old_links; int i; + if (!old_links) + rem |= BIT(0); + if (!new_links) + add |= BIT(0); + for_each_set_bit(i, &rem, IEEE80211_MLD_MAX_NUM_LINKS) mac80211_hwsim_config_mac_nl(hw, old[i]->addr, false);