From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.34 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792471426; b=0bjbxHJ3JMk3kczM7cjeD3Un8f70mOa+StCRlP+vLFnx5R/SP0vMRtdEsMZclhobAc1n FeOG3kJU7/hm1T+fKitB50wBnFriKmhycUm/blGgFzq3RRJflUQtuyVT8KjlVMDbDZAn/ VIyXgiRyxtZH8WOc9H67aey+ilesCJFftjCmlYE1erWXzX961j+UfGJ+s6AaOq6saS/nJ C10m5ynA/Qr1YeUSIVZWRBZRvSrCsDwbPwZdgM2iqNKfHh9Ksk11SUkzwCjnHxfbjSdoh Nmoeh41Qo+O/XDMc9p8/YOHXCj/5/k/Hu+5DcZ1pXVzEcI9FGAc9mAQbZiO/xAf5bHw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792471426; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:MIME-Version:Date:Content-Type: Content-Transfer-Encoding:From:Message-ID:TLS-Required:Subject:To:Cc: In-Reply-To:References; bh=TftrrPNtsyBwyu6P4BuDulXkrmUzNiS7FTTDkxdm9u4=; b=p5gQx5dpbHw7AiJIBdwILJ6jXFaWLGuniy7PZwBnbhMGYlpsR0EStzWuotFTtn438G3q e2Y6OxYNgqatKVTY0zqaieHKIBpMBKjLiBkz6eknBR+QB2v+P8LCp3vq5hJTqfHa347KI MZIAavw1y6sJq8kVdjitb8KaVx09DJcuBClY4srjR7PpbCpMONtPhEVLIEsSRNICsQYn+ 3TkhCKaqPTz7udhlTl4d4ipyoTcrCLcP14978wGjf9+nf8UYxKzLxjzOyaJr2qaJ4KtT9 qSWwYf9ODcwQP74Hy11gX8nxv6Raauw5RO9/JJTf/6WNUYJqUHyCe490QLL9JGOObFg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=CC8iYWGT; arc=none smtp.remote-ip=95.215.58.34 Received: from mta1.migadu.com (out-34.mta1.migadu.com [95.215.58.34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD611606A319 for ; Tue, 20 Oct 2026 04:43:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DD611606A319 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=CC8iYWGT X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=dC7VvThPiocukbh7F9YYC7tvYdPI1VO2U/KFB7y+I0c=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1792471422; v=1; x=1793076222; b=CC8iYWGTEZHJuaXzGSPaexyEz3uudLE53kxfFS+2LWFS8cY8mDDBnjJSnPKyRND3Kvjny9cV HhUOconMknDSG+EmPp2p9y0ZpRKJMEYVy1wJRaKdR2MSwGo3pTX1OuqzQPwdfXw0jdtqm3Ublj3 rWcPoMwzmVFysyv+KRwm44ag= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 398ce5b28278dd5a; Tue, 20 Oct 2026 04:43:42 +0000 X-Mizu-Trace-ID: 398ce5b28278dd5a X-Migadu-Flow: FLOW_OUT X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Date: Tue, 20 Oct 2026 04:43:39 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: "Luka Gejak" Message-ID: <334c6e785a5d242c6f168d57d042d63b777a242a@linux.dev> TLS-Required: No Subject: Re: [PATCH] wifi: rtw88: allow key removal when the CAM table is full To: "Ping-Ke Shih" , "Hungyu Lin" Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, reza1234khan1234@gmail.com In-Reply-To: <9bde49a2e7794e4fb6bc3ae104eef87e@realtek.com> References: <20261019165103.5990-1-dennylin0707@gmail.com> <9bde49a2e7794e4fb6bc3ae104eef87e@realtek.com> Hi Ping-Ke, October 20, 2026 at 4:07 AM, "Ping-Ke Shih" wrote: >=20 >=20Hungyu Lin wrote: >=20 >=20>=20 >=20> rtw_ops_set_key() looks for a free CAM entry before checking the > > command. When all pairwise entries are in use, DISABLE_KEY returns > > -ENOSPC without clearing the existing entry. > >=20 >=20Is this the actual case you met? >=20 From=20my investigation it seems reachable. As far as I undersrand, it needs all 28 pairwise entries (4-31) in use at once, so AP mode with 28 secured stations (31 mac_ids are left after the AP vif), or IBSS/TDLS with as many peers. Not reachable as a plain client. Once it is hit its pairwise DISABLE_KEY fails, mac80211 frees the key anyway after logging "failed to remove key", the cam_map bit is never cleared, and the table stays full until the driver is reloaded. I think it can be tested with two clients by temporarily setting sec.total_cam_num =3D 6. > >=20 >=20> Move the allocation and bounds check into SET_KEY. DISABLE_KEY uses > > the existing key->hw_key_idx. > >=20=20 >=20> Fixes: 10d58823cb44 ("wifi: rtw88: fix out-of-bounds CAM write whe= n key table is full") > >=20 >=20Should it be ? >=20 >=20Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver") >=20 I=20think 10d58823cb44 is the right tag. In e3037485c68e the check was if (hw_key_idx > sec->total_cam_num) { and rtw_sec_get_free_cam() returns at most RTW_MAX_SEC_CAM_NUM (32), which equals total_cam_num, so the check never fired and DISABLE_KEY always reached rtw_sec_clear_cam(). The bug there was the out-of-bounds SET_KEY, which 10d58823cb44 fixed. DISABLE_KEY only started failing once the check became ">=3D". This patch also does not apply without 10d58823cb44, since its context has the ">=3D". Since 10d58823cb44 is tagged for stable, I think this one should carry Cc: stable@vger.kernel.org too. Best regards, Luka Gejak