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 790DE3BE166; Mon, 23 Mar 2026 16:24:04 +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=1774283044; cv=none; b=L1q6TP3Wxljg0shRqe+au9vyUesWeU4WHB1KApATzLzb9NQmTOrahH6JRxsHiAQj0dr5VkKkpacDzEw9CUJ3wa1mXyKJ9ZdTtVNs17eeYdILm6HKX02/3vhfGkDYjrkdSqSzwu11cs3d0cGQGli49PqTawuzHaRp0RxWPOdKpCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774283044; c=relaxed/simple; bh=7UJtKZCTneT7WYdHS14JnuIG22ZAS+E61kOyS7oV1TA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A4h1GWbB586DvytSpC4fbUZmOWNa4Z0J6JdeQbhMK9RjwJsi30RtU9PGYyWomFnR0hVBmfnupnb722Jz7VZa9j4qSRNT9nmH9vh7jyylinLfx4UcxEhnhLWysU/yYOqeC728UAj+NyElAAc/HVIdfwQAJ4moK/cnDhrLiUenLIs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ryh0OZXz; 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="Ryh0OZXz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12481C4CEF7; Mon, 23 Mar 2026 16:24:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774283044; bh=7UJtKZCTneT7WYdHS14JnuIG22ZAS+E61kOyS7oV1TA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ryh0OZXzt1sEi75FwpCd0s36f0zHms3OgDUK8lDm4w9FV6lHkQu1Xks+l9xf9KZAm JluXi79gtYPcQebQVfJ78mUQNiEPRrBA7mu/uZslkixu0ucGMWiAb1uoHLNqaxkgFf 9pvd+LEjhMixOFEB7sBKIRYXpRNDoRz4cah3d2zA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, GangMin Kim , Eric Dumazet , Jakub Kicinski , Bin Lan Subject: [PATCH 6.1 382/481] net/sched: cls_u32: use skb_header_pointer_careful() Date: Mon, 23 Mar 2026 14:46:04 +0100 Message-ID: <20260323134534.446465516@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134525.256603107@linuxfoundation.org> References: <20260323134525.256603107@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.1-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: Bin Lan Signed-off-by: Greg Kroah-Hartman --- net/sched/cls_u32.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c @@ -159,10 +159,8 @@ next_knode: 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) { @@ -212,8 +210,9 @@ check_terminal: 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, @@ -227,7 +226,7 @@ check_terminal: 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)