From nobody Tue Feb 10 04:12:41 2026 Received: from mail-dy1-f179.google.com (mail-dy1-f179.google.com [74.125.82.179]) (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 222673168EB for ; Fri, 16 Jan 2026 01:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768525544; cv=none; b=tCONL5Rjje4qU/pYnTC3HywTiNyriuuHcls2ECPdHgQyW29KOfi/VE9oy1Wa4V2MWNikz5YqMOUyONp2yjnhpM2jfb479BSIaKduxhSL7FBYoAu3ucDsv8Z8POL2JdDqaQZBhmXqrSpfvZblPpsVgiggived690Ulb+HIkS8Wzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768525544; c=relaxed/simple; bh=y94WeVxba42kdyHkNRz0nzHnFxtZWYsnVp0GS8SE25U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nT59IDg7Z2/iXAh9MYPKPejPz4PrrHgnnN5xA5ldwZfiBTLA3qyKP1H184zxdcQzbZsV/ltjhw6xeIJfrnx3XJzUh8rnMkMl2+6JTGGG9f9hMa8bXVFUmimgbA5wxvJBUZF2ZOfH+AcNFtJABp6qSYyG/rWqsQ1nMd0W2LBqh5c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zacbowling.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HD2l/Qpj; arc=none smtp.client-ip=74.125.82.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zacbowling.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="HD2l/Qpj" Received: by mail-dy1-f179.google.com with SMTP id 5a478bee46e88-2b1981ca515so1731886eec.1 for ; Thu, 15 Jan 2026 17:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768525535; x=1769130335; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=zWTGhizPE0uX/1Ee6qZDpLjHp14QecuWlmzggUKYyNs=; b=HD2l/Qpj2cq/wxU2LKd1NUDgMmUB1c5MPoCU0ZaANi01FPx0GecyWlMbW0GukoS4Oo 28pIwFhMdzSdOSOrYSl+RldzmTm/NHrD+5jDUKaYSCLVsAvqrDX6/uuMp2K6CA6yyxZn MU0HhAqF17KSL4LzvLQvXQUgXLe4Q9QKZg6lzMqY0E+hVeyIAp2ye9YFnC+Z3lwnnS7d BRXb4f//0PsypwDpqkuYRVRJcDv++NIojE9pWoJb8/3eJf/+Nqd6s+/5CvAgaKfwRpJ6 CvChyD0ruEWVaGS0bPfx2MLVvwMbj+kZXDtpsvIU/qDnVJPzOhULdBqCtgLQn1f5+EB9 0EQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768525535; x=1769130335; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zWTGhizPE0uX/1Ee6qZDpLjHp14QecuWlmzggUKYyNs=; b=UmWI+lImBQSDgTuKRloZCJ9lhBx5jkh9u934A4xpQsEzJhBYj5+jNleu/RjypqQUhN fPqXLtlUruiVWuJKvdUhLFPt5xjptZOKzIEs9MjftNzzZZqEa1qFl4nm5J2rYX+r1t5l 0VaYmiGT8ZcXshqgQ9KuNzD/+bLUNZU4a4ZdHEFEuVMC/0sn/e4A3GCVyJPSdqBU5iwe 7bj9DRrNooDFaJbzmYo0u8Sq/Oz0X8D3hJuDkwact9RGKln90ASR6Sdk4R0b51d2R13K I50VAfQGRrEfksSPoSXcmHDy70eXcmRshJ2KRp9RgUFFUEYosxYw9j/mIsnMLf7ZoL3E pZ4A== X-Forwarded-Encrypted: i=1; AJvYcCVFSI+N63deYB50ghnltQfz3bP+DfOhtenAG/V85dTR3dN2/zPm/sIeZnHwJ1F9ob2OmarhoTLGJJ/NFB0=@vger.kernel.org X-Gm-Message-State: AOJu0YynnJtbkNOPvC7Y/MKXvg/+LWbqBNL6QUdfQpIS5xymj61AeyZK c3/x9drS4qOfs/UYDAZt3wfn8cjYrK2yYsWESzCVK49FAWoDxwLoKkPZ X-Gm-Gg: AY/fxX46QFgyjttzRCUGZhHmmnhTPVKO3GmNW8eTA2DmJMJwlOEX0JarLSiJH5w3He5 ZUzEmyo94dNlAjgJkAdytwOSqefwBIu7iN+9UN8oIVCXUWbTB/XN856g1749ThDzxtLo0ZqsNjG j87VWSf+UZ8zHLzUv5RE2zmIS1oMizJV3IGCEvyqI5y1tw7cxgenEIdv3Z7HxwmIlkaWvvjSiTK KernEe+oXfAAA359KJc53ZckOa/NpoYK1ay2zr+VZTt9QPFU6hYoSAh0MvVEYuqC/HcHc0CtZ4j N3WEMXYOZpQbFwi027mrWiyRmXLpipaB4IpJHVm4Hj9VY/5eYaR/9CB6wVxOM+of2RkX0CX2OHY W0dS0oiMf4S3CagzHcHs9Stc4zAStQhUwJgrT5tmLsE5xo1fGgBp/95st27zEPY0cLj71LcVLrq yOgF5mdhTMNNx87BDexLedN6EdbuwKO5dxVZTGjw7+0nvtLm95EJaynyvxjm184g== X-Received: by 2002:a05:7300:748a:b0:2b6:adb4:8a18 with SMTP id 5a478bee46e88-2b6b40c8cf0mr1480744eec.22.1768525534956; Thu, 15 Jan 2026 17:05:34 -0800 (PST) Received: from zcache.home.zacbowling.com ([2001:5a8:60d:bc9:f1d2:502c:a6ff:5556]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b6b367cbc9sm1019884eec.32.2026.01.15.17.05.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 17:05:34 -0800 (PST) Sender: Zac Bowling From: Zac To: sean.wang@kernel.org 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, linux@frame.work, ryder.lee@mediatek.com, sean.wang@mediatek.com, Zac Bowling , Zac Bowling Subject: [PATCH v4 08/21] wifi: mt76: mt7925: add error handling for BSS info in key setup Date: Thu, 15 Jan 2026 17:05:06 -0800 Message-ID: <20260116010519.37001-9-zac@zacbowling.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260116010519.37001-1-zac@zacbowling.com> References: <20260116010519.37001-1-zac@zacbowling.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" From: Zac Bowling 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 a7e1e673c4..058394b2e0 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.52.0