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 A0E1037C106; Mon, 9 Feb 2026 14:50:07 +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=1770648607; cv=none; b=iFg36s1fRfcNy2tzf6LUUMy2XO98TIQgw8xrELS+LfVhbTb8I5yzrcPgzwVOUFbbJy3Llxu7OpiO0QQPYPqGW4MpPPoZ/1iNsh37XAHJRujsFPrs7C08I5fJExiP7g9lbiHhfVkhKR+npsHNDHQSFkmRJt56fHkxrxoqqkKZtHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770648607; c=relaxed/simple; bh=/NHHziRo7M/vg+fjQIrGeauIoXZ3IpTnE/jxIOEetPs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bx4OqxiMdEHG0SUJDUEaL24GewtOceDoKxdbCUOipxBumkse/6dLKoFsJbd7A4bIoi9lInFIy0idqBn4ddRPICrWlaCrxK+WLoFk0FG8PbZymD6HB4JDe257wrSn8VnuqnxET0hKg2MurodxueGWHB7o/5RQf3kI0xd670gFmqI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F9x2GN81; 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="F9x2GN81" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D85AC19422; Mon, 9 Feb 2026 14:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770648607; bh=/NHHziRo7M/vg+fjQIrGeauIoXZ3IpTnE/jxIOEetPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9x2GN81vHQkdhA3MR7rQ1UrG9qUh51qxj0lCBfQCIHAABoaoHl39VGskicaIJE1m ahG8HLi8jKUTPM6m0LlyVIhkY8AhFLSLoNPfyC28chUwga/9Q+zCIJvhp5GWX34i0o AA9UBdLw3FHwUdwjCLa1SlhhM6ZxxIuEW6nZlZvc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, GangMin Kim , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 61/86] net/sched: cls_u32: use skb_header_pointer_careful() Date: Mon, 9 Feb 2026 15:24:24 +0100 Message-ID: <20260209142306.973531985@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142304.770150175@linuxfoundation.org> References: <20260209142304.770150175@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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet [ Upstream commit cabd1a976375780dabab888784e356f574bbaed8 ] skb_header_pointer() does not fully validate negative @offset values. Use skb_header_pointer_careful() instead. GangMin Kim provided a report and a repro fooling u32_classify(): BUG: KASAN: slab-out-of-bounds in u32_classify+0x1180/0x11b0 net/sched/cls_u32.c:221 Fixes: fbc2e7d9cf49 ("cls_u32: use skb_header_pointer() to dereference data safely") Reported-by: GangMin Kim Closes: https://lore.kernel.org/netdev/CANn89iJkyUZ=mAzLzC4GdcAgLuPnUoivdLaOs6B9rq5_erj76w@mail.gmail.com/T/ Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20260128141539.3404400-3-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/sched/cls_u32.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 67f27be138487..1338d9b4c03a4 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -161,10 +161,8 @@ TC_INDIRECT_SCOPE int u32_classify(struct sk_buff *skb, int toff = off + key->off + (off2 & key->offmask); __be32 *data, hdata; - if (skb_headroom(skb) + toff > INT_MAX) - goto out; - - data = skb_header_pointer(skb, toff, 4, &hdata); + data = skb_header_pointer_careful(skb, toff, 4, + &hdata); if (!data) goto out; if ((*data ^ key->val) & key->mask) { @@ -214,8 +212,9 @@ TC_INDIRECT_SCOPE int u32_classify(struct sk_buff *skb, if (ht->divisor) { __be32 *data, hdata; - data = skb_header_pointer(skb, off + n->sel.hoff, 4, - &hdata); + data = skb_header_pointer_careful(skb, + off + n->sel.hoff, + 4, &hdata); if (!data) goto out; sel = ht->divisor & u32_hash_fold(*data, &n->sel, @@ -229,7 +228,7 @@ TC_INDIRECT_SCOPE int u32_classify(struct sk_buff *skb, if (n->sel.flags & TC_U32_VAROFFSET) { __be16 *data, hdata; - data = skb_header_pointer(skb, + data = skb_header_pointer_careful(skb, off + n->sel.offoff, 2, &hdata); if (!data) -- 2.51.0