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 4B2F043FD01; Thu, 30 Jul 2026 14:58:32 +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=1785423513; cv=none; b=R/n2T0KxMj0sYhqzggZJqz3elzPCe5Z99J9RZl/MOMEJL6ROBQvg4NJnA2+hAWZVl4Tb1+XYA1Hp46zGWwvuokVMS+bUb4gafZTRVsUdXebTMCUJso+ZZoBH0MgSeG2Ptcg5rXvYswDPdshstfQZFScqXONT46O21uYaSCMhQR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785423513; c=relaxed/simple; bh=R/T5pVAe0SbaD7f3HeIz8dJ+zU1QlgG6UPclTtfMV24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vith7s1fGX+8KIR8aBbdPzqgba+t+bY2iqgYYWMC2lwukfUEMF41sBTELlgm4pBTCUS62G909NH+aX72GuYdqymB+VT8UY16VdmoduVwgfSElvUnSuNnqv9HpymWzQKA+ExpVDScQiYkpEtGO+QBfV4mRZcSJWuzBUVgbg5phGI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KnrLocEn; 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="KnrLocEn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A52581F000E9; Thu, 30 Jul 2026 14:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785423512; bh=7LX8gybiglR0IRdGPwBCRXjQnAgG0pwX+8LDp0IBaZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KnrLocEnR3sayYuv5IHbLN/dL1xztVkjokHPpPIfGijdfxehSAZtDZ4f7DcXpejpG 1lpUqt3w1LOAso5FXeyHvdPfHRXRAWbWDoxy5baF7tn0eNWJ0FaHsRufCBqM/KThq+ 47HqluG0NzFq3J7wizzamPz8j5KhJJ5bigZ6iFzo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryam Vargas , Johannes Berg , Sasha Levin Subject: [PATCH 6.18 068/675] wifi: mac80211_hwsim: clamp virtio RX length before skb_put Date: Thu, 30 Jul 2026 16:06:38 +0200 Message-ID: <20260730141446.571273050@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141445.110192266@linuxfoundation.org> References: <20260730141445.110192266@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 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bryam Vargas [ Upstream commit 10a2b430f8f06ae14b9590b6f6faa6b588ef0654 ] hwsim_virtio_rx_work() passes the virtqueue used-ring length reported by the device straight to skb_put() on a fixed-size receive skb. A backend reporting a length larger than the skb tailroom drives skb_put() past the buffer end and hits skb_over_panic() -- a host-triggerable guest panic (denial of service). Clamp the length to the skb's available room before skb_put(). A conforming device never reports more than the posted buffer size, so valid frames are unaffected; a truncated over-report then fails the length/header checks in hwsim_virtio_handle_cmd() and is dropped, so truncating rather than dropping here cannot be turned into a parsing problem. Fixes: 5d44fe7c9808 ("mac80211_hwsim: add frame transmission support over virtio") Signed-off-by: Bryam Vargas Link: https://patch.msgid.link/20260620-b4-disp-474bee37-v1-1-1a4d37f3e2d4@proton.me Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/virtual/mac80211_hwsim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c index 20815fdc9d3764..a0724e1c530709 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c @@ -6898,6 +6898,7 @@ static void hwsim_virtio_rx_work(struct work_struct *work) skb->data = skb->head; skb_reset_tail_pointer(skb); + len = min(len, skb_end_offset(skb)); skb_put(skb, len); hwsim_virtio_handle_cmd(skb); -- 2.53.0