From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 2B9644E36D6; Fri, 9 Oct 2026 14:48:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557327; cv=none; b=S6rVblJgf3J4WZgtGR4slOmcambXPjgGBI/m0Exbn+NHY9rexOEu4nnN4GiyMJGhm+LmUwYq4CdXG2rrc8HYRSFQ1GsffT4SlTVeZoqbDIcwCX1s/oPqWt8gP2t2jm4s9oiO3drnFtYP9qI4OUrfd3aK5If9VgoifxcIiQaqBa8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791557327; c=relaxed/simple; bh=CpQuM5t0yFFv/UDhmV2AP1DIjaHx/RTlWryOStGA0GU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b9t24pxhaWUukhbFGHWRzVBt1ttgiYfXhRhpSK0+RgXPmnfjYCmyeN7HOOGtJ9cffn3CVnh/Ampf8SV3k69H293MRt/aTZkw6JZoYz9YNIjhAoWZYfkUtsHPbubwmp/CC4kJ+5/5jlGOA0Fm2HsUOdxeioWa/vm2St1uaHLHZIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UydOtdM3; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UydOtdM3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 866F91F00898; Fri, 9 Oct 2026 14:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791557326; bh=2l8XCFpc2dcTJ542yIu9IbYO/A6uJIfKoyuU0+aU8I0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UydOtdM3QKWRtJbidA3qfDN8aE6Bd7gMMpYnop8bAU+D4Owk/KGQTE6K/OTwXOO+L 6aZg8J+M8hcg1WbzPhZAAX7kNBL66N+RHn/ehBtesO3dF5r57OBzb5+0utZjmXE5Rh RsT8P6tG2y4Inf2GMaiktRRZfFUa3M60KJr7HXAs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vega , Yuqi Xu , Ren Wei , Johannes Berg Subject: [PATCH 7.2 338/428] wifi: mac80211: handle empty FILS association request payload Date: Fri, 9 Oct 2026 16:11:15 +0200 Message-ID: <20261009140953.570763860@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140946.008206689@linuxfoundation.org> References: <20261009140946.008206689@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yuqi Xu commit 5bfd4b0b40b79781d900cb2f7da0685070f53c67 upstream. fils_encrypt_assoc_req() accepts a (Re)Association Request frame whose last element is the FILS Session element. crypt_len is then zero and aes_siv_encrypt() is called with an empty plaintext. kmemdup() returns ZERO_SIZE_PTR for a zero-length allocation, so the unconditional sg_init_one() puts an invalid page into the scatterlist. With CONFIG_DEBUG_SG this triggers a kernel BUG in sg_set_buf(); without the debug check the bogus page is handed to the crypto backend. AES-SIV is defined for empty plaintext and the S2V result is then the complete output, so handle this case before the CTR step, which has nothing to encrypt. Fixes: 39404feee691 ("mac80211: FILS AEAD protection for station mode association frames") Cc: stable@vger.kernel.org Reported-by: Vega Assisted-by: LLM Signed-off-by: Yuqi Xu Reviewed-by: Ren Wei Link: https://patch.msgid.link/325c048982d637a3af80d74ac5b36e9369b93f1e.1789751126.git.xuyuqiabc@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/fils_aead.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/net/mac80211/fils_aead.c +++ b/net/mac80211/fils_aead.c @@ -90,6 +90,14 @@ static int aes_siv_encrypt(const u8 *key if (res) return res; + /* With an empty plaintext there is no ciphertext to produce and + * the S2V result is the complete output. + */ + if (!plain_len) { + memcpy(out, v, AES_BLOCK_SIZE); + return 0; + } + /* Use a temporary buffer of the plaintext to handle need for * overwriting this during AES-CTR. */