From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 96C18331A44; Wed, 8 Apr 2026 18:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775673782; cv=none; b=uirfG+T36Q90oXdsb6Aq5d4gKQ9Xhq2R11LvUT3A3tAtn6stdSDpGRvomoRXduqcn6rVT9MYZ5A1N4As1wsPjIy3PSn9ogVSyMFdnVy1BsF447qUSk9t8KiSLa8+RalqdmbXwX8MpLTFzu5IJ5e/dc7ji6OKfXF0fUBu2vJxuhs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775673782; c=relaxed/simple; bh=lE3kd2rGg5yLD5P7QkSun8I32hRkwFF+bYRGbBJb/R4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fwXgmtZAPbbKE+7cWcQdRAXrY0G9OocdDKCYYHRAe8Ghq8x3QOBsCJP0f7xI5tm+0a4tZUBvhMIuQ69GT4kbLh08gOUt7YgiECVJezEwNtXMMZ6OmIxKpGbAmxGYWtn0fx56/oa47mLsSTGL4vLNhW4BN92FNvHgSB5qot+odfo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HBGwGPeW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HBGwGPeW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC6CFC19421; Wed, 8 Apr 2026 18:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775673782; bh=lE3kd2rGg5yLD5P7QkSun8I32hRkwFF+bYRGbBJb/R4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HBGwGPeWx/oEPs2IiVKL3XzDbmLNxF7MsbRgmNUtHLIs0nJsvqLRWP89tETqcCTOc LUzR7cW8BzBaYdQSYBcTHLWcJsAfbE7t2Xaz6C+IrWeBYI4cIi8AYRp6BHUYHVOdGP 6Hyyq4RoVUV/G1yotv9v1V3fLdAFbHGYG0ErBEw4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yifan Wu , Juefei Pu , Yuan Tan , Xin Liu , Yuhang Zheng , Yucheng Lu , Stephen Hemminger , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 088/242] net/sched: sch_netem: fix out-of-bounds access in packet corruption Date: Wed, 8 Apr 2026 20:02:08 +0200 Message-ID: <20260408175930.380106395@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175927.064985309@linuxfoundation.org> References: <20260408175927.064985309@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yucheng Lu [ Upstream commit d64cb81dcbd54927515a7f65e5e24affdc73c14b ] In netem_enqueue(), the packet corruption logic uses get_random_u32_below(skb_headlen(skb)) to select an index for modifying skb->data. When an AF_PACKET TX_RING sends fully non-linear packets over an IPIP tunnel, skb_headlen(skb) evaluates to 0. Passing 0 to get_random_u32_below() takes the variable-ceil slow path which returns an unconstrained 32-bit random integer. Using this unconstrained value as an offset into skb->data results in an out-of-bounds memory access. Fix this by verifying skb_headlen(skb) is non-zero before attempting to corrupt the linear data area. Fully non-linear packets will silently bypass the corruption logic. Fixes: c865e5d99e25 ("[PKT_SCHED] netem: packet corruption option") Reported-by: Yifan Wu Reported-by: Juefei Pu Signed-off-by: Yuan Tan Signed-off-by: Xin Liu Signed-off-by: Yuhang Zheng Signed-off-by: Yucheng Lu Reviewed-by: Stephen Hemminger Link: https://patch.msgid.link/45435c0935df877853a81e6d06205ac738ec65fa.1774941614.git.kanolyc@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/sch_netem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 2270547b51df8..825c398aa1232 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -517,8 +517,9 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, goto finish_segs; } - skb->data[get_random_u32_below(skb_headlen(skb))] ^= - 1<data[get_random_u32_below(skb_headlen(skb))] ^= + 1 << get_random_u32_below(8); } if (unlikely(q->t_len >= sch->limit)) { -- 2.53.0