From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 2090E48BD5C for ; Tue, 5 May 2026 17:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778002708; cv=none; b=TqAKSjZ/5l6+cQR/i/f1Lu+n/gzhRdgoaVcgmaSoCVGPkYmWyi8n4Dpeq3TASXSitHOJvO8n+GzKWCYiuIK3FG109kGckafVXFURulwE3ppPR6B8C2DmUg572siVaBjrhY0oqHRpbJOBGNV1h3opTzx2XvlkUKDfVEftQiGSmiQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778002708; c=relaxed/simple; bh=INBOCCEs/oacPKzfuDtT4wyL09tCY+XD1saY/b1Qxm8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cVbEqqQXe+NEpqaFl0Leca7Edlkfp42aEjJZedZ1eBEEucA9RHbY3wc2Gq/oIWb/ujdyJCulKENRpkbXyCUSSVGYHcvDnrwpjj1REQaVmEgf0can65CaJXBjJmpF3bS4s1wFY2Uk06UMTJzY5MaS6YywILPpt1fwC1RqOS0JAf8= 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=RGBRTXao; arc=none smtp.client-ip=209.85.128.41 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="RGBRTXao" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-488a8ca4aadso58409195e9.3 for ; Tue, 05 May 2026 10:38:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778002706; x=1778607506; 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=t2pGThJvtdEZffGBgV5Up5wNelL6nr81TpmNS4CpWqE=; b=RGBRTXaoTS4M+VAJv/1ea0T7VZps12uZSu9ontPhUHtfPQMGqMmGgy8dng8VjRLP/8 erPfUO0oqryspOFY25a5hbOrT97mFrlVifqOwB4ecgfr1EYnSsahjsbVhaawh5jJOcqA DtsonXd21JiC7USrFBJ/I+3oWs6jf36v8BwyBNv63V7qUAnPUryyCGuxKjhOYk9YH8Cp nZhvorX/0OjmhvlLKADLtyCqHvmjxAzphnjRaivCUiuflqn1MItCxDQ59awd5zzA189W eFNCE/nJe8iYNo+gKV6ZAC8VICRE5OUSnyJBQ0i7YELDqmd2w5z5ON/B8ZlxWMeIC72S ehaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778002706; x=1778607506; 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=t2pGThJvtdEZffGBgV5Up5wNelL6nr81TpmNS4CpWqE=; b=JyjQlAddHELodz1EL5hsx5GEO1+bMK5b9E5DPdrqCZ/J2zqSlh3srUQVhwrTdTXnBO dFr4MmclRz4AfdJgJJROc/S68+KpEaRsFWIeKjzaZiRzwyforFdM1P4UQLQMUOoRd1Ha +4D6oRnM0+/j5ykpGwL23RnthSOTxXcQfBVL760xaxCaY7m+IQOH9BcsMn8eQmHWIeT0 +SrGolJJTWfTtkQP9UQOgMGTSwD6lZCLfCXkX1R44dqLPlEH7cvIS32PCjvbJNXNVOkE e3e11nzoxV0Wu7PSoyqIqRt9Cxo2B9nMIM0WsnfWz3oInOvKFpyu3vqBN8G5S3AQD5SI M+XQ== X-Forwarded-Encrypted: i=1; AFNElJ+O9oyKkT2HNj/Mjxrmhsqc3SFzdFYAH0TkDaWyx260M5KM+mbfAQ7ezDFfMQqZpt/tA1vIVcPWoQvHnT8=@vger.kernel.org X-Gm-Message-State: AOJu0YxBb28bZGtWzdGaNHa3c2lGXb3QSIr/RBJjKLY7uVC69W2fFdXo utGrMy2t34mZ1GCEhJs8d9FN9mR+RCwPS35lpF/oGW9a/x+CWBIvkMsiSPxyzw== X-Gm-Gg: AeBDievrT2GiDyj2gUaOVAMGnZTQMMh/aTemTwXdA/Kbl9GC2iODHCsE0SBXM7hL/gc Yvta4Cv3sRYq7N64yvw9U8EzqH8UL31w42S9V/ggBvREIsBIalhHvA6RjtDV+MBapyiOMzDi8O5 9t+orPmQqwOvbKh1+SKjAuJ/fuvpKM/JSrBaj4BK5ChWt4AUowMEiQ/EmLDap/Y3mAcILmtxAdk S/q9pvr5xcEufyHWzHq4VRpdDZ9u0lFfXS20Mb2tBfl5JVAEtFPm4vSyREfkX0lLKxRn30co1N1 I9VhTyPYMglllHGgDsy+ESs+RNFizDd1C6DYtLujQfxG6OKjxps6tgXHcGnqSC6B6Em5ZNsAEqI fkIwop7cFaAtibQ8OxI1TllDEa1zml6EeuF+2ZkpZECEMQxugsXysPvUpR905qHAeko25kCxcPe PxQ+ocTfGBiOctkjbvqSGG9luZPkQJ9EB1phQimlFvCgexTsCU0bReIMWpryuUTdc63R7UzSNbU QSvD+nheyb7ycctxvmnvmcyzrXdTe1C8aErPu6EDy/P34THs5HWrVMd3/+UvfTKBePHUg8= X-Received: by 2002:a05:600c:8b08:b0:48a:5501:7995 with SMTP id 5b1f17b1804b1-48e51f32ca9mr3729715e9.18.1778002705492; Tue, 05 May 2026 10:38:25 -0700 (PDT) Received: from ahossu.localdomain ([82.78.232.184]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48a82301ad1sm655473875e9.9.2026.05.05.10.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 10:38:25 -0700 (PDT) From: Alexandru Hossu To: gregkh@linuxfoundation.org Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, error27@gmail.com, luka.gejak@linux.dev, stable@vger.kernel.org Subject: [PATCH v4 0/3] staging: rtl8723bs: fix OOB reads and heap overflow in IE parsing Date: Tue, 5 May 2026 19:38:15 +0200 Message-ID: <20260505173818.3674164-1-hossu.alexandru@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026050436-italics-clumsy-e83c@gregkh> References: <2026050436-italics-clumsy-e83c@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit v4, addressing the sashiko review comments on v3. Regarding hardware: I do not have rtl8723bs hardware available. The patches in this series are derived from static analysis of the code, cross-checking against the 802.11 spec, and reviewing the patterns already in use elsewhere in the same driver. What changed in v4: Patch 1 (update_beacon_info, bwmode_update_check): - Added unsigned underflow guard: if pkt_len < _BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN the subtraction that computes len would wrap to a very large value. Return early. - Swapped the WLAN_EID_VENDOR_SPECIFIC condition so pIE->length == WLAN_WMM_LEN is checked before memcmp(pIE->data, WMM_PARA_OUI, 6) to prevent the 6-byte read on a short IE. - Fixed bwmode_update_check(): changed pIE->length > sizeof(struct HT_info_element) to != to also reject IEs shorter than the struct, preventing the read of infos[0] on a zero-length IE. Patch 2 (issue_assocreq, join_cmd_hdl): - Added pIE->length >= 4 guard before the 4-byte OUI memcmps in both WLAN_EID_VENDOR_SPECIFIC cases. - In issue_assocreq() WLAN_EID_HT_CAPABILITY: added minimum length check and replaced pIE->length with sizeof(struct HT_caps_element) in rtw_set_ie() to prevent reads past the HT_caps struct. - In join_cmd_hdl() WLAN_EID_HT_OPERATION: added minimum length check before casting pIE->data to struct HT_info_element * and reading infos[0]. Patch 3 (rtw_get_wps_ie, rtw_cfg80211_set_wpa_ie): - Added two bounds checks in rtw_get_wps_ie(): break if fewer than two header bytes remain; break if the declared payload extends past in_len. Added in_ie[cnt + 1] >= 4 guard before the 4-byte WPS OUI memcmp. Alexandru Hossu (3): staging: rtl8723bs: fix OOB reads in update_beacon_info() and bwmode_update_check() staging: rtl8723bs: fix OOB reads in IE loops in issue_assocreq() and join_cmd_hdl() staging: rtl8723bs: fix OOB reads in rtw_get_wps_ie() and rtw_cfg80211_set_wpa_ie() .../staging/rtl8723bs/core/rtw_ieee80211.c | 9 +++++- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 30 ++++++++++++++----- .../staging/rtl8723bs/core/rtw_wlan_util.c | 14 +++++++-- .../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 8 +++++ 4 files changed, 50 insertions(+), 11 deletions(-) -- 2.53.0