From nobody Fri Jan 9 00:49:35 2026 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0805F1DDC35 for ; Mon, 5 Jan 2026 00:26:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767572821; cv=none; b=MNvwQsJmpkGmAOs6j7T/zzCyKa2cpRbGQtNQEoiQvOHxab5JLhgCgWp0ya7VbqwT7zorhx/yvhBofuH2sv9PyWvvsUiY0LRBY35VH4Dfaf/dFJP/IJviEXxGMQ1mfL9X64v2FSZ1Mqt1RAeh6R3O7fNAc3r3rY3kYdvML6IyPfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767572821; c=relaxed/simple; bh=9wMw4Xb04PSrFVmyO0HNqMXeSWHTRirn2UmUmWfZAjc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gEhuxtIT2GrMAoM3D1dmryhbdz1qL1gvRrRIYjTNhZFHFQIbNGmn+CDllvK93kURMD4Se1Vvp1R5jtNzjjxztCJB/c/30LCocld8gFM+ZYNAFPlWxizrJs/7E4+Knjz/6jIWQvZMUKdxVuv7VD4HjJisCTaqKTvG0UFt691/WP8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JrKDTdW8; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JrKDTdW8" Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-7baf61be569so13946079b3a.3 for ; Sun, 04 Jan 2026 16:26:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767572819; x=1768177619; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NDFNq4JsZcxs1GGsQxpxUqJ7LLS5xEhchca1DSQB1FY=; b=JrKDTdW87ouCu11jxBsHZrm8ZJ8/xwwuK5sVYPxty10TmbLMh1x9LfWqPUCWjQHS7R vlF9hN3myb8o9Olt6kkVDPOPjhnQKQifnbmnYt0+6GGiNUF6xCWjCwT4cNsNxv6AaS0c TqDKKISmRbMafyRULdI916iwJVTkP+FW8b7DF4UFqhgtjfO7+EdmBArGCohnZYee/Sqm rmqvRm8+y0ZG6bmb+A+PlCOsw1BF//XOhd7/SdbYkX0FOBHYss3ZnbrOgp77hLvmLgiB dhplydhGK36tmoxg40Yc2wqbdqTo3BmvnVojqJjQ/m89NPxeXqpml00YuI8WS4+KzzH7 Thow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767572819; x=1768177619; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NDFNq4JsZcxs1GGsQxpxUqJ7LLS5xEhchca1DSQB1FY=; b=WhJTAPEO8Isyk2SUAFftAbNUD+CBbaYeGi55Xn9wXMmR599tLHYPyUx4ASuJhsFYN5 bjxq1wdawF3b0XTZK8/Towvax81hy70DzzL80vdSNI/M7igtDyEa27Uuy9BOKBCyDsbu Hvj7EIUi9tyx2kxEsSjTw+MVAvDD7xj0ypGKdEeWa9s8eEz1h/gvlLm9G9l9BYTpAFgS fJDu9QPk0cck5TIIFccjZY6goil/abPYwZlNvcndYFPGBe67SCxbC6hfMZP2QiOVgr7b O37i6mXbnyQ22nabJN5NkZGqzjCF/izbUZRBk76TWULqdJK0mdXXVeiGNNO3bO2Ijd5o zn3w== X-Forwarded-Encrypted: i=1; AJvYcCXcytcT/6tyycNaYBV3nvs1QGB5XEbcf0kT0OgDtxHKd3TOBoJdSr3u6OHioqRdUugrBLbbPFLMmFYTQtg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7N0lRFFllPvR4XFAAAftr25WiKErMMyYrf7Xv5t6nN5G/q+Fo QYrfOk6AfVB96z0YqKYomagWPKbZCzAevf8IQW1tRMUhRvRh7N2IDA3D X-Gm-Gg: AY/fxX5VY4krKbmXLfGcndfgWy1NxnWX6oCxtkVGHFLPNYDlrvxbTsB/HU9LyjzeX79 uD//kOMzM32QNxKoUdpU0I8YNRt5HhalLFremwUQbShGMxhzLH5/CZzdxqGIVnVu6DYHk2Sn1pS /NoeDomxaCVN7laX7k2nRLHNG7oeyxRJB+5+eLkWtWM2rs0yMzvzmZjZDa/SJ2Ywcq2rS92Ab1u l/H7sq3dQb1OVcZvpqLiLM5zUPvVbwXOScoU/FBznD7VLi6XQcm0PTr1LkTHN23Mi9xVdigwnNn CWbf2Dpsh5SHS0OzlmtYlSh6tgDI93Urrutgt8VtuO0ZRegJEmdRqQhaedBnq5eanwAD0eIXex/ 4bpu3dG1xoAQoe/Iub03Jt3IbLGoMJbOEufDXEEq3zIveBdxsDBbtWsPUqZC8Fr1C/6IGPTxlG6 +PMZaN4w68TRZRUm6R9gSyLJAkyfYzJrGWgVxVQNr/nJd7WX7M+5Mu9v0xnavmzWgelfguOWiis w== X-Google-Smtp-Source: AGHT+IGeeKmkZlgIpVZni90ulNKu2CTVrD//QHX+vZIPY7voqHaSNcphqKMalZRbGAYUw9J3u9/Low== X-Received: by 2002:a05:7022:eac1:b0:11d:c91e:3b58 with SMTP id a92af1059eb24-121722e9e26mr38779723c88.39.1767572819190; Sun, 04 Jan 2026 16:26:59 -0800 (PST) Received: from zubuntu.bengal-mercat.ts.net ([2001:5a8:60d:bc9:9ebf:dff:fe00:f8f2]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-121724de268sm133378109c88.8.2026.01.04.16.26.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jan 2026 16:26:58 -0800 (PST) From: Zac Bowling To: zbowling@gmail.com Cc: deren.wu@mediatek.com, kvalo@kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-wireless@vger.kernel.org, lorenzo@kernel.org, nbd@nbd.name, ryder.lee@mediatek.com, sean.wang@mediatek.com Subject: [PATCH 08/17] wifi: mt76: mt7925: add error handling for BSS info in key setup Date: Sun, 4 Jan 2026 16:26:29 -0800 Message-ID: <20260105002638.668723-9-zbowling@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260105002638.668723-1-zbowling@gmail.com> References: <20260102200524.290779-1-zbowling@gmail.com> <20260105002638.668723-1-zbowling@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Check return value of mt7925_mcu_add_bss_info() in mt7925_set_link_key() when setting up cipher for the first time and propagate errors. The BSS info update with cipher information must succeed before key programming can proceed. If this MCU command fails, continuing with key setup would program keys into the firmware for a BSS that does not have the correct cipher configuration. SECURITY NOTE: Silent failure here is particularly dangerous because the user would believe encryption is active when the firmware may not have the cipher properly configured, potentially resulting in unencrypted or incorrectly encrypted traffic. This ensures the error is propagated up the stack rather than silently ignored. Reported-by: Zac Bowling Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt= 7925 chips") Signed-off-by: Zac Bowling --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net= /wireless/mediatek/mt76/mt7925/main.c index a7e1e673c4bc..058394b2e067 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -637,8 +637,10 @@ static int mt7925_set_link_key(struct ieee80211_hw *hw= , enum set_key_cmd cmd, struct mt792x_phy *phy =3D mt792x_hw_phy(hw); =20 mconf->mt76.cipher =3D mt7925_mcu_get_cipher(key->cipher); - mt7925_mcu_add_bss_info(phy, mconf->mt76.ctx, link_conf, - link_sta, true); + err =3D mt7925_mcu_add_bss_info(phy, mconf->mt76.ctx, link_conf, + link_sta, true); + if (err) + goto out; } =20 if (cmd =3D=3D SET_KEY) --=20 2.51.0