From patchwork Thu Apr 18 08:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790470 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 651DB15A499 for ; Thu, 18 Apr 2024 08:52:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; cv=none; b=RjRhi688cAqw8gL9vMREdVybSeIOEm9uGeMDA8P+8UXwM/apCMkirfFww6JvGgtFBbTs5UNzzYazIl2VSveIFFxmooy8bodOpAnNhkcScX+GelxtDXSuA2i116MOAsD0zmKf80Us01ieb3/OST3d7ebHmb1LVC5qEXqEuk/bZ+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; c=relaxed/simple; bh=ic1msN5tmISeUCdOjVCKVfBcVNyyzBxWsBminIYjo1o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BDdeuodQLjN8eMTH2GS6rLxxr1FQOCqElzcQ1SvgclMn2pkYAjwcUb7BIGloF1+sG1TdXPoCRh1oOafOjFOXf52TKJVPBGMx00FPwCMWx2aZifffnVhchpuTY0jC6/PptYelN/lDQcWVWECzOhAQP1AwiJV9+2RQVUfT1dFHGow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=gavP0t2T; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="gavP0t2T" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=VyBcvUdkHv130+nutZFFWhe86AxTJkftAD0IEJ1h/Zs=; t=1713430353; x=1714639953; b=gavP0t2TQbZ0aW0npn0XUkRz41LWgNPQHvaP2j4J36ebP6nfspoGfHHztcRXqzn9Ui3a8OygHX/ 4UvqVRU8z7jGyH8Q7tFWkDIv3zfS4+hnTVhNbl6xcyL9jW6asyQm9S3C1IVC4sPdaNhgcHyBe5kim mzi+1TxpPGxXnnu6yhOw1Nv9jS0KpjH+PsuZvYSxwOFsqZFut4dW5d8FBMhp85Dh92ZvORvRhQ2bb WPowEzU2fivAnkZSm/r6EnMpZqBV6piLixtBeuB6ugys+YK7V+n/5kr7NqxOKU8fG+EvMui/LTjGf 97qz4ASmyaAMgkQu9FIDL+AL9AB1GIt2SLOw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVI-0000000CIvO-156A; Thu, 18 Apr 2024 10:52:24 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 1/8] wifi: mac80211: fix idle calculation with multi-link Date: Thu, 18 Apr 2024 10:52:19 +0200 Message-ID: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg The vif's idle state doesn't automatically go to true when any link removes the channel context, it's only idle when _all_ links no longer have a channel context. Fix that. Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/chan.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 80e4b9784131..ccacaed32817 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -797,6 +797,7 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, struct ieee80211_local *local = sdata->local; struct ieee80211_chanctx_conf *conf; struct ieee80211_chanctx *curr_ctx = NULL; + bool new_idle; int ret = 0; if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_NAN)) @@ -829,8 +830,6 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, out: rcu_assign_pointer(link->conf->chanctx_conf, conf); - sdata->vif.cfg.idle = !conf; - if (curr_ctx && ieee80211_chanctx_num_assigned(local, curr_ctx) > 0) { ieee80211_recalc_chanctx_chantype(local, curr_ctx); ieee80211_recalc_smps_chanctx(local, curr_ctx); @@ -843,9 +842,27 @@ static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link, ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL); } - if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && - sdata->vif.type != NL80211_IFTYPE_MONITOR) - ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE); + if (conf) { + new_idle = false; + } else { + struct ieee80211_link_data *tmp; + + new_idle = true; + for_each_sdata_link(local, tmp) { + if (rcu_access_pointer(tmp->conf->chanctx_conf)) { + new_idle = false; + break; + } + } + } + + if (new_idle != sdata->vif.cfg.idle) { + sdata->vif.cfg.idle = new_idle; + + if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE && + sdata->vif.type != NL80211_IFTYPE_MONITOR) + ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE); + } ieee80211_check_fast_xmit_iface(sdata); From patchwork Thu Apr 18 08:52:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790471 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4D115AAB2 for ; Thu, 18 Apr 2024 08:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; cv=none; b=sEnZzm9cB6cfuFBZzhvkqPlbY+EmQhmg7LWeufPCqP6rELdlu5Ocle1aPXu/+bGq0dCTu7ZooKNKmg+mN1kxymVIIjQm5iSw40q3KC7rWypXhVjpILbZXn1WkTd0xOhMwu2XjLwzbc5sxwybFqMGc6ARFv5BIk/K3lG1lOsFNj8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; c=relaxed/simple; bh=FZWjRDeZ7I3Jm48qImbEx1ZJtfTBKfdaZZR1Si5EMds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G7pi5YrCusOybkC5qaB+Jit/DHHWbx08GTSFdf679bqM8tgMY4X5SVGs+DpQZJ7++3FzzSZc1zp0v5WOjUt1vdZTW7OOtLhgu8dOK9WPW4vfxN6sWLeJ7pwWf/Kyh7ZvdZvJio2LebTQAZu57QjvvGhS3c5mW9OUQFM4X9GpN1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=LIGL2uMz; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="LIGL2uMz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=QU2gUPFup3r6nTJn+Hbmd95Utnrgxk9QPq90kMGKeSk=; t=1713430353; x=1714639953; b=LIGL2uMzPmI7FafcJ3o0eDl4Kyq/gYZzcX4QPH1poQetZ/k d0Rbnv+UkLRa1NejMT1+crJm8ZkDN9WbPSSJppZCpEzfaadZbTUirpebVz3TqAee2pG5mObH0LANE +iDhEC/7q52vp7kXM/u5sGHt6F2hleF6ww2X8i9fD034uHi7mjVBNhu2wrWw6KUdMxgcDBWphGwa6 9TzEywqSUtdjpcbc+oPy9Sa9tAdH+pimzyCexDv7MQvlsXO0buORbm58W/GlhySQ2NebNeuZcHoML YeGf+DMCQ4AnEBRDRiEhTgwO/qB6d1WVFGsdh0OzNPn1vFn0bHHsdY4UUTiVvn/Q==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVI-0000000CIvO-3vD7; Thu, 18 Apr 2024 10:52:25 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 2/8] wifi: mac80211: mlme: re-parse with correct mode Date: Thu, 18 Apr 2024 10:52:20 +0200 Message-ID: <20240418105220.5e0d1fcb5622.Ib0673e0bc90033fd6d387b6a5f107c040eb907cf@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg When doing re-parsing in ieee80211_determine_chan_mode(), the conn->mode is changed, and the whole point of doing the parsing again was to parse as the downgraded mode. However, that didn't actually work, because the setting was copied before and never changed again. Fix that. Fixes: 310c8387c638 ("wifi: mac80211: clean up connection process") Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index db7128f6c901..98cb475a14c8 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -616,7 +616,6 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata, .from_ap = true, .start = ies->data, .len = ies->len, - .mode = conn->mode, }; struct ieee802_11_elems *elems; struct ieee80211_supported_band *sband; @@ -625,6 +624,7 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata, int ret; again: + parse_params.mode = conn->mode; elems = ieee802_11_parse_elems_full(&parse_params); if (!elems) return ERR_PTR(-ENOMEM); From patchwork Thu Apr 18 08:52:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790172 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF47F15AAAD for ; Thu, 18 Apr 2024 08:52:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430355; cv=none; b=F7EWmH04fvsXnCEWvn243+wiHFEbHYwWtPB7OThEMLUMBgMXQDKH9Ft+3kDITqAZJGiIRy5Wf+hpvcM/M4r/Cd3mZvp2n/e8XGUtSxx8js6St6a3fgraHVZlpMnP00Bt78e5iXdBVzrLx2gZBbgXXVWLwbgvfMeo/ECK/WgiyCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430355; c=relaxed/simple; bh=9hoUm5POCuTxc3+9KwPVjrX1Tb9aEkNsvVgbiRa9z70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pmZdm9ppC0DX8+89cSevZgi2JLXxC3vtGQIgKq7JgfG1PtVALue0u85xFyBmsoRI6VoA7wUHSy+fPqT4ROgKUI4WiIIhBmU5UBnrjjhDUGDZEOKydYvQTl5LM7GYKhDXvEcllXqcDHn9FzDv4xfnlDXqZvn6w0sChwwnJznHfK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=a4z3vcv4; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="a4z3vcv4" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=ay+c9wu6kl7oYkHo5zpr+zpGhSopkkHHh+yc2Ug6Jbw=; t=1713430353; x=1714639953; b=a4z3vcv4CiRksvFRha518lBeACIbZevAkr0zf2BTTKj47pw frFD4U301sgFSAG/kklOQM5T/6dZog4qOoy0srZqUz7gZ1s+ShcQJetkQuQLdBDzIEbPmnzOzsj2S s2cveVMTf/JOlwTxSFTaPzTW1nJrhVei+pwlHgKqp5RExowYVzS4D68u4GA8YX5VFdLpuRwf6NWyn VQOQyLT14PfPKdx+u9S+HB6aV/cb6rSbkZMG6KuAG4rqAa+WfI6Dpb+v0Jqcj2ieVnxjA4tdlAJDs xXSTBfPRDeYkmdxSP157P3TGC0W4ZFC3YiT8o3mGV/IBQR6taYKQFU8iFxCm6C+Q==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVJ-0000000CIvO-2Ve4; Thu, 18 Apr 2024 10:52:25 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 3/8] wifi: mac80211: mlme: fix memory leak Date: Thu, 18 Apr 2024 10:52:21 +0200 Message-ID: <20240418105220.458421e3bbff.Icb5b84cba3ea420794cf009cf18ec3d76e434736@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg When re-parsing the elements here (with changed mode), free the original ones first to avoid leaking memory. Fixes: 310c8387c638 ("wifi: mac80211: clean up connection process") Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 98cb475a14c8..6fa3752b740e 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -753,8 +753,10 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata, } /* the mode can only decrease, so this must terminate */ - if (ap_mode != conn->mode) + if (ap_mode != conn->mode) { + kfree(elems); goto again; + } mlme_link_id_dbg(sdata, link_id, "connecting with %s mode, max bandwidth %d MHz\n", From patchwork Thu Apr 18 08:52:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790170 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0724E2E403 for ; Thu, 18 Apr 2024 08:52:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430357; cv=none; b=OxBNtySZ+KuthaexOeRN+YeVyQi3CAhHUqh2j9VIu0hyrPe/5Sqlt97T+3u2aDPiy2SgldKmfqgGdOrwqDcO/LRBAZBNAZEKQ5x+vLldg9OVEsCHzVn4tlhemx3hXJHSsbmTmFy/Flq9BGJw8oD4aFSDN4RUnCbkByHyTOLZtdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430357; c=relaxed/simple; bh=wFrEyj32PeQLJfETjCmMhKJdKWgKLh8yFrZj3/AOOJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aFb6Uo3sSWMhTY9BFaozfRc3dA138QmSPlDjjv1flBF9U9Q+ajwqbSCdXTEluILZJR4RXAP16MNcD/VghGQkjvAhIL70IMUyfsOIybbyIMnfucW98+jqvMnF6vTdIZ8GT+ojpI0r7YzI9L8IFJ3H/7TPntAT/MTRDoaY4xIt02s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=PcfSItAh; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="PcfSItAh" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=sjl/TBaQ2FsUM8rXOQOzPCWw1Ve6RluJx/APc2DYfFk=; t=1713430355; x=1714639955; b=PcfSItAhnORtqqpiPT0/9BUBq9HjW7JSbtDR12FUo1zCjp8 4R+NoI6NjYloEnkiyUdHOEVh6hZg/uxTcFLWRjAcajr5GNn3EUCqPWcSimF+WHGX2aErVdlDuTTw6 e0unw9cpcKmCTBZb6olwxXttv2PvXy53vbxk+K2PoK3zztVSjRt2jrfA3CTvOHhHavPg0LTczpzBL tK61KdgF5zruD1s8ibVeVZ4Z/KDpAXA9oy6RH1iYZ3mYE0DTsMqkfv7PFv1xA+fIkzdZouj0YToHF 8HEnu6bo2PsJ6ADLgurqdV182B3UN0FXBub7abt3tOfcHOGHArFygfstDvXgQGvw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVK-0000000CIvO-16JB; Thu, 18 Apr 2024 10:52:26 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 4/8] wifi: mac80211: mlme: re-parse if AP mode is less than client Date: Thu, 18 Apr 2024 10:52:22 +0200 Message-ID: <20240418105220.d1f25d92cfe7.Ia21eff6cdcae2f5aca13cf8e742a986af5e70f89@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg If the AP mode ends up being determined less than the client mode, there may be different reasons for this, e.g. AP misconfiguration. If this happens in a way that causes e.g. EHT to be rejected, the elements need to be re-parsed since we'll connect as HE, but not reparsing means that we'll still think it's OK to use multi-link, so we can connect in a non-sensical configuration of advertising only HE on a secondary link. This normally won't happen for the assoc link because that reuses the mode from authentication, and if that's not EHT, multi-link association is rejected. Fix this inconsistency by parsing the elements again if the mode was different from the first parsing attempt. Print the message a bit later to avoid printing "determined AP ... to be HE" twice in cases where ieee80211_determine_ap_chan() returned a lesser mode, rather than the regulatory downgrades below changing it. Fixes: 310c8387c638 ("wifi: mac80211: clean up connection process") Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 6fa3752b740e..502c34d52fbe 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -632,15 +632,21 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata, ap_mode = ieee80211_determine_ap_chan(sdata, channel, bss->vht_cap_info, elems, false, conn, &ap_chandef); - mlme_link_id_dbg(sdata, link_id, "determined AP %pM to be %s\n", - cbss->bssid, ieee80211_conn_mode_str(ap_mode)); - /* this should be impossible since parsing depends on our mode */ if (WARN_ON(ap_mode > conn->mode)) { ret = -EINVAL; goto free; } + if (conn->mode != ap_mode) { + conn->mode = ap_mode; + kfree(elems); + goto again; + } + + mlme_link_id_dbg(sdata, link_id, "determined AP %pM to be %s\n", + cbss->bssid, ieee80211_conn_mode_str(ap_mode)); + sband = sdata->local->hw.wiphy->bands[channel->band]; switch (channel->band) { @@ -691,7 +697,6 @@ ieee80211_determine_chan_mode(struct ieee80211_sub_if_data *sdata, break; } - conn->mode = ap_mode; chanreq->oper = ap_chandef; /* wider-bandwidth OFDMA is only done in EHT */ From patchwork Thu Apr 18 08:52:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790171 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BB5515AACB for ; Thu, 18 Apr 2024 08:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; cv=none; b=AiqjR+0PicN29Zs2Yq4lmgLaCDn82/KfVZ/co12rwziiyue3iAWN5Yc3G8vlZTsWS2r5vjiR/rUKs45jp1lQHduWCheGKEXLLf9bwZvb0e4FWaEMklRb7N17e3joIHEgZKvJ+ER8dADyAkaJU/Hl2dy+NJYzOEVx55oy8wciy3s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430356; c=relaxed/simple; bh=vCd8u3N5w/fGbAvjU7foKfLM1z1GiDWyU5CdD4qiu2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fYFBMyUmib+JjCz1/8/gbTk+4fRSbCqFhb4cJ6eGLM1/8kErjg1YQ90P/bUY3cmdchuRjuHh8sQwUOutzJA4VJOsVV48uTOgrDbLWnDU38cBQUhws5In97rgmmVdGg6Mb4CxEUv6k8SDMR2fx+I8ljOcx4LVrRVVwr1kDF+prZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=gc6oFSFF; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="gc6oFSFF" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=lia9aGJ7ZZV7DUgVVqlynCBBe+EaF3Gt5BYAEzt/vDA=; t=1713430355; x=1714639955; b=gc6oFSFFM0UaodGouasipqi4oHCKlCqZl6UUGN90h8V3Yiz iziDIxWblQvxrqniX+rK/4O92+iRIKwFxM2vKbzavAkGZ9KybR/ppPI9keRRfPOd3OEkOZJU98sLl O1AwF5NxMCiRGcuzWw+paXax6TsDKsqWHqe3Ve7a9KVAKxrTKQqS4gjodoj9hFYUOO8J0adOJy3kr 4aMYDV5ZpzZOOBVhxbx+THgohZ93PJ5HgkqNJnyxxI+myPrwP4dxgUfCX8H0nJYNZqjDHQ1rD4fU6 o/ut/GykA6egXH6ayV6pyjCjwYk2whNf+MlFiJ/LcX8tEjPZ2wf0T1+rcfo9urYQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVK-0000000CIvO-47Og; Thu, 18 Apr 2024 10:52:27 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 5/8] wifi: nl80211: don't free NULL coalescing rule Date: Thu, 18 Apr 2024 10:52:23 +0200 Message-ID: <20240418105220.b328f80406e7.Id75d961050deb05b3e4e354e024866f350c68103@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg If the parsing fails, we can dereference a NULL pointer here. Fixes: be29b99a9b51 ("cfg80211/nl80211: Add packet coalesce support") Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/wireless/nl80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b4edba6b0b7b..30ff9a470813 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -14030,6 +14030,8 @@ static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info) error: for (i = 0; i < new_coalesce.n_rules; i++) { tmp_rule = &new_coalesce.rules[i]; + if (!tmp_rule) + continue; for (j = 0; j < tmp_rule->n_patterns; j++) kfree(tmp_rule->patterns[j].mask); kfree(tmp_rule->patterns); From patchwork Thu Apr 18 08:52:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790469 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 597C615AACA for ; Thu, 18 Apr 2024 08:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430358; cv=none; b=i3d8KlBJXGuEWDLHKkPpS+FwTAvTNSurceV75PMv3XsXsP7PYOAFOiSpBV3lF5RwBls6Z4S2XUnLlbiwgcxZLJX1ttb+AETkXal4lE11lhBCOsvctzW5sNsU74VyBpgCok2l/wCBXPR9QAIx/cyc8BI+eUXa/hUhCcfvvLnM5JQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430358; c=relaxed/simple; bh=vAWkDa5jUKiMHqZBlTNC345dG2WBtzYy1qkZ4fVFJNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=giSfr/zBCmI6jKzHsd5hbBycoQ7ecSV09p24J8lG53K9o+8rIBhxH0acJfV+pBJ0F9soN1xI+sInHxBzw5rHkHGJRr2Nz/mc6NAqFlpFeiXoCqeetf0BRC2XKi9hD7haRSZjLnO15K1nEEpkOxtrGpctlzK5Y36GA4lmKhbOQz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=s8rm0Rce; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="s8rm0Rce" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=D/u2jsp8cLgU+425jsad0NTt3fx7STSVK2rsPR3RWgg=; t=1713430355; x=1714639955; b=s8rm0Rce3ZsdTaCdVvcKCEFmm7DZPSyeD6R800jKDlVCqBn J0syopx67ngLhrBYeRv9m9GSHxcMtchksgD6DZDO3EiiPC9Dc79Su4yrZyE+dvujr9pKFE32+Jo8I AoZQ+x+JVMV/7+Zbwa7TDteTKJraSkb3ImkO2GZkLMV47+idP9GMztLzxLsUo/Q8UnpORB7gF6ZEy PLyIFsnCJgHBhWjB9XMoXgd/KjUrS8FUnaQvem5R6bung/Y4nE6Q1qFhC56SVT9EoRdkVwYOMh154 DB4fTubOQUkAAKqJRLNCeybFWZHvaV/YJIFAxKCgQw6YKJbzPMhzsUI4vHUmOvjQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVL-0000000CIvO-2i90; Thu, 18 Apr 2024 10:52:27 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Miriam Rachel Korenblit Subject: [PATCH wireless 6/8] wifi: mac80211_hwsim: init peer measurement result Date: Thu, 18 Apr 2024 10:52:24 +0200 Message-ID: <20240418105220.e1317621c1f9.If7dd447de24d7493d133284db5e9e482e4e299f8@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg If we don't get all the values here, we might pass them to cfg80211 uninitialized. Fix that, even if the input might then not make much sense. Fixes: 2af3b2a631b1 ("mac80211_hwsim: add PMSR report support via virtio") Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- drivers/net/wireless/virtual/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index b55fe320633c..59e1fc0018df 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -3899,7 +3899,7 @@ static int hwsim_pmsr_report_nl(struct sk_buff *msg, struct genl_info *info) } nla_for_each_nested(peer, peers, rem) { - struct cfg80211_pmsr_result result; + struct cfg80211_pmsr_result result = {}; err = mac80211_hwsim_parse_pmsr_result(peer, &result, info); if (err) From patchwork Thu Apr 18 08:52:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790169 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E45515AD87 for ; Thu, 18 Apr 2024 08:52:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430358; cv=none; b=W8O+ZvzysTaZG1Q81IrH5pJWqFuqdkh1yzmD5TQ6iHqnD98QBkR9bBWn7CtD246E3fqmt9Cni+vOHwjQqm/UXnxfBj8uiEahl99xzGcELqrMTX/VVkeYu0+n0zdFvuAVZVstL9FJSEfEyUcUOh+fZtgMqTw35E5eS2Wk6kBXzPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430358; c=relaxed/simple; bh=mvruYw4saUDVm5zPI1IzfDgLRoWPqMCaiNXgNnuk/vk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lPSi/fiDk/+n618OGUEG6wxW9O8Xdrz600MAFJhYflEjPmnC5wlgpfczNyufYcxQK9SZX5/k5rlxbA96S+W9hhY+GaA/HGTDoaeulAJuSE+Mkutz0LE/lrGspvLNEXTj/Tldc94Zwv1EMOX1QdNwqpr+JWQ5mRMUQSnS7CgLpWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=JQ7hSYG2; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="JQ7hSYG2" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=kNli9u6orNuA7CdJECIvuq1y8pxjKPckEnOk9fMa+CY=; t=1713430357; x=1714639957; b=JQ7hSYG2wKhiEWe2KPZG61eO//ZDhV/+6950prxd7jYTW31 ZkM/2DjpQmH2GZlUC1sZzQi7IHDaPLY7du9wsDl45QLRaWq0FpKTJCI9TAXGNzRjvZuweY9yRabWw 9NHLyCTVVPQREAYkHpUEBmeQVVJkr8g4GYA3Jr5gkZvm5B7h4xOBLlWBaJppe8llNIxE0J5MmlJLw W2KzUVlEGhuYYOcC5tp8BF8SZieCHeAQSTH6U95UrXiqBowZJphxbKSD3RGPnq/GegGKdQZODDLyh MmsUKHRmhEzPVJ4h6xVvHADVb9KyWYiOIome0UTUWa8lwLrtJCyIC1sWVlGOiPQg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVM-0000000CIvO-1aX2; Thu, 18 Apr 2024 10:52:28 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Ilan Peer , Miriam Rachel Korenblit Subject: [PATCH wireless 7/8] wifi: mac80211: remove link before AP Date: Thu, 18 Apr 2024 10:52:25 +0200 Message-ID: <20240418105220.03ac4a09fa74.Ifb8c8d38e3402721a81ce5981568f47b5c5889cb@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg If the AP removal timer is long, we don't really want to remove the link immediately. However, we really should do it _before_ the AP removes it (which happens at or after count reaches 0), so subtract 1 from the countdown when scheduling the timer. This causes the link removal work to run just after the beacon with value 1 is received. If the counter is already zero, do it immediately. This fixes an issue where we do the removal too late and receive a beacon from the AP that's no longer associated with the MLD, but thus removed EHT and ML elements, and then we disconnect instead from the whole MLD, since one of the associated APs changed mode from EHT to HE. Fixes: 8eb8dd2ffbbb ("wifi: mac80211: Support link removal using Reconfiguration ML element") Reviewed-by: Ilan Peer Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 502c34d52fbe..6f0880ec89da 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -5844,8 +5844,11 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata, continue; } - link_delay = link_conf->beacon_int * - link_removal_timeout[link_id]; + if (link_removal_timeout[link_id] < 1) + link_delay = 0; + else + link_delay = link_conf->beacon_int * + (link_removal_timeout[link_id] - 1); if (!delay) delay = link_delay; From patchwork Thu Apr 18 08:52:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 790468 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F22E15AD91 for ; Thu, 18 Apr 2024 08:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430358; cv=none; b=G8VyNCH6I5jubSt88+hdSbGeOa5DcGJuDNxXwlqj6FRC9C97F94r9oUhUyrUPUkZfcO9aPQgAwA+/ARuSyroqXUOdFzFMFZquhfPr/bti+3gt0+JOzs6yKq6TYmQYeMDWLWfJnJi/PRXYJ/JePGCWZlkiOptB8fY+ZI72qYUXBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430358; c=relaxed/simple; bh=r4OOmK+HKCtlholLfoyxeLt/X195g3BwwO4SDytNI3M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oB16EuGTRNy1KjD1pSSAmVfU/b6vdxV8AdgcKCrKbOQmQmHrOGtShF2bt/K0H8EFyV1Kes/odqltuq4zC3VYi/7FYnD1ppwYq6Bej7YGdyYVWUYUXqn1kaCY+nVmCrrCwsF1SEKm7Ap9dHwLf3zVug00oaq159Yo4o/6ZMEd0jo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=Kf/fw8kZ; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="Kf/fw8kZ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=kFcmn48v4nLQKI+zj5YVOA1rasu4U5g2/A5yyErjaDw=; t=1713430357; x=1714639957; b=Kf/fw8kZJFzkAwMzp1p2vErioOmzifT/fopgXzkETiLTE54 6yRn7SEcbBRyJ2B08lpUrxCCMt9yq28jnwR0KNcBEn6nC29Bs7s83iyB5sdg3Osh0SW3m39KHmp8C 0jm0REuVdP8DPUAgH/VTW/1cYvjkkdWFxs5WvYvmAiafLsS3NGFXP/WrA4srrp0pT8ySWRZXLsHCj aOOAlaQ+oygNnwXsHXITo1XwQCoqWmU0XZgfLw6F5HsSEkzIIlIoW+V3tRxIftfAb32oOBIAoVAHR HrEUzn8Gzqti/PgZyTlBez4XUzHV/kIC629TirS3XXHED93emC0v/YJIvwSFDdTw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.97) (envelope-from ) id 1rxNVN-0000000CIvO-0Gsz; Thu, 18 Apr 2024 10:52:29 +0200 From: Johannes Berg To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Ilan Peer , Miriam Rachel Korenblit Subject: [PATCH wireless 8/8] wifi: mac80211: fix unaligned le16 access Date: Thu, 18 Apr 2024 10:52:26 +0200 Message-ID: <20240418105220.356788ba0045.I2b3cdb3644e205d5bb10322c345c0499171cf5d2@changeid> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> References: <20240418105220.90df97557702.I05d2228ce85c203b9f2d6da8538cc16dce46752a@changeid> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Johannes Berg The AP removal timer field need not be aligned, so the code shouldn't access it directly, but use unaligned loads. Use get_unaligned_le16(), which even is shorter than the current code since it doesn't need a cast. Fixes: 8eb8dd2ffbbb ("wifi: mac80211: Support link removal using Reconfiguration ML element") Reviewed-by: Ilan Peer Reviewed-by: Miriam Rachel Korenblit Signed-off-by: Johannes Berg --- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 6f0880ec89da..3bbb216a0fc8 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -5819,7 +5819,7 @@ static void ieee80211_ml_reconfiguration(struct ieee80211_sub_if_data *sdata, */ if (control & IEEE80211_MLE_STA_RECONF_CONTROL_AP_REM_TIMER_PRESENT) - link_removal_timeout[link_id] = le16_to_cpu(*(__le16 *)pos); + link_removal_timeout[link_id] = get_unaligned_le16(pos); } removed_links &= sdata->vif.valid_links;