From patchwork Wed Oct 19 08:25:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5060 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp248203wrs; Wed, 19 Oct 2022 03:42:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65AwoI2w9PjG9KyAj3FSttzJPgwmNEfxMnI97BeFoFYjUKKmyFCgQvB9oreaPuA2ueFClk X-Received: by 2002:a17:90b:1a91:b0:20d:268b:eab with SMTP id ng17-20020a17090b1a9100b0020d268b0eabmr8816578pjb.177.1666176174963; Wed, 19 Oct 2022 03:42:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666176174; cv=none; d=google.com; s=arc-20160816; b=wVtuvWKlYrdl32V/A6qi/VRCnfNcRB9Pzb4moomlCtsVc2z9PDBkFSYqK5t0JvRl3k BE01/Rc4iz93pjcQFOxFZisAOQ9sfaJ/BbsxUIhGgvjxhFofU53PwWpoyvNf8Y3QoWTs UPdkZZ188fUVDtnb+TBxrkwUJI8KqAqH8WXrwMjpcHRLszF1cQ+o/m/YUbTe+Ruupmpt WYdb6lr6lbyU5TsXcO9D2SNxl6npKppscRJaVOnMFqpSyLnp16dPVy+k9inDia+YzQU+ 6s+0Z6GqbWKMev1zYxVLRCDF9pvAoAblQiKbhoUv9aty2Kg74zV5RRDuwF8K/ptKCR9D wHZA== 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=5uFaWiHe1r2pfkkvJNdB31S/kew3EFwJ425xGQInfxI=; b=JR3y1eXDY156K5rp+66D3iWLWMXK+iYwC30/CZiGQbJglLvFJmXsWKEsdIljHjIor4 xiSAk3Ad7U4P1VSHip5F9jBcz/F304n1yFw9HT89y6i+XImZO/2IPGzodZTfFj2cnbH0 cyiq9u3uIElerzIGalOctp/sI4rRZo8bHje186bq8SnFIAr7caN0uPRNuCfcg0WGtEpK +7nbW6F0D3PnZ/x7BJI6r+3tFLiRkHmwrDc9eEMeSZO6yqJYJvjSHT99R9GTUXN3sxKw Cqb9ajuOAvW7wB1qRSaZ9g3hsh8oR4nf8EiYAknkT+XsnHyKr3vksrWlXSItiqVnEaUF hnsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lDJz5hR1; 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 d5-20020a056a00244500b00563764cecb3si19057003pfj.279.2022.10.19.03.42.42; Wed, 19 Oct 2022 03:42:54 -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=lDJz5hR1; 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 S232426AbiJSKl4 (ORCPT + 99 others); Wed, 19 Oct 2022 06:41:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbiJSKlA (ORCPT ); Wed, 19 Oct 2022 06:41:00 -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 1C9A06346; Wed, 19 Oct 2022 03:19:13 -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 150BEB8239C; Wed, 19 Oct 2022 08:52:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DDE3C433D7; Wed, 19 Oct 2022 08:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169524; bh=0rl2z4tAdKp81nWROTRI1+4Lj05dL4bQD7NiLYtYuRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lDJz5hR1jIq5fKQh8W6f3zWYkstLZXX/BU6ots9kDonAIXkRAv7RHiGZP2Qioh98F k0lFczFm3Sv4fxZrKi+b/wsfKIo/quU8w0nJ/S+kpDSMrE1Cz42CmhuKJxLW3QKqX+ QAXQdHRloYrwjD6DYqbtCVA5T+Qy1AFuqlHQ1zsA= 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 266/862] wifi: mac80211: mlme: assign link address correctly Date: Wed, 19 Oct 2022 10:25:53 +0200 Message-Id: <20221019083301.786453547@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?1747112348768543174?= X-GMAIL-MSGID: =?utf-8?q?1747112348768543174?= From: Johannes Berg [ Upstream commit acdc3e47881d86dc1cb89d4603e3fed90ab150db ] Right now, we assign the link address only after we add the link to the driver, which is quite obviously wrong. It happens to work in many cases because it gets updated immediately, and then link_conf updates may update it, but it's clearly not really right. Set the link address during ieee80211_mgd_setup_link() so it's set before telling the driver about the link. Fixes: 81151ce462e5 ("wifi: mac80211: support MLO authentication/association with one link") Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mlme.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 76ae6f03d77e..654414caeb71 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -6291,6 +6291,8 @@ void ieee80211_mgd_setup_link(struct ieee80211_link_data *link) if (sdata->u.mgd.assoc_data) ether_addr_copy(link->conf->addr, sdata->u.mgd.assoc_data->link[link_id].addr); + else if (!is_valid_ether_addr(link->conf->addr)) + eth_random_addr(link->conf->addr); } /* scan finished notification */ @@ -6378,9 +6380,6 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, goto out_err; } - if (mlo && !is_valid_ether_addr(link->conf->addr)) - eth_random_addr(link->conf->addr); - if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) { err = -EINVAL; goto out_err;