From nobody Sun May 24 20:33:20 2026 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 90FCA19343E for ; Sat, 23 May 2026 13:04:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779541460; cv=none; b=ExoRYcB9uvL8n++PYxjbdBVODHw1NIdJnWF0sFv6PEnsB/cqk/MnbyqQ7UXD9EKziAXQQagKCjjUfP/2/KOy9bOehd0Cfj/wjeOP7iQj3xqAn48UJ13wCnRiRIT9hHch+xPe8sZYKBPN8HSRi93SvTlAd4n2z/98P8taX7B8GVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779541460; c=relaxed/simple; bh=eEl4h13aEGggQbGNLeM0QYTHvyscGGMytZxSMyoWPyU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EmE3pWky76gW6cdxnYL5hKp0R2fIPUzQcgRWSm02KQD9mYQ4vdotgNWMbQfSBk2JORm/GQr9FEii566vMNkz8taax7PT1zgShQYheK/fvvofHqXb+xV8JXO6r2fnXVPvmL0bSyG8A4HEt/uq71Ib/F/rDxrW535PD2+6zJLbUvc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ZISTbxDf; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ZISTbxDf" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779541455; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7YubSZ9kYFNF5kRdJe7Y7jxoT376P/W7OO4m2z6juOQ=; b=ZISTbxDfi+eFv2MIrTTwPdZZaJF6kI2nww4DIcva1zOvoP8V9b1mgUkZBvGoyheJMvGLIa hxy8BK/YRa4vBBBBzwCsXXeYH0l1IG1H3heerr/4YhtmZnnfTVao0S30BxhI6gYiSc8kWx +CdoFSawX4uv5vrEk38USRH3VXWTwcg= From: luka.gejak@linux.dev To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Cc: Luka Gejak , Felix Maurer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] net: hsr: fix potential OOB access in supervision frame handling Date: Sat, 23 May 2026 15:03:30 +0200 Message-ID: <20260523130330.61880-1-luka.gejak@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Luka Gejak Ensure the entire TLV header is linearized before access by adding sizeof(struct hsr_sup_tlv) to the pskb_may_pull() calls. Without this, a truncated frame could cause an out-of-bounds access. Assisted-by: Gemini:Gemini-3.1-flash Fixes: eafaa88b3eb7 ("net: hsr: Add support for redbox supervision frames") Signed-off-by: Luka Gejak Reviewed-by: Fernando Fernandez Mancera --- NOTE: This patch was previously part of a net-next series and was=20 seperated as requested by Jakub Kicinski. Link to the old series is [1]. [1]:https://lore.kernel.org/netdev/20260513182657.20346-1-luka.gejak@linux.= dev/ net/hsr/hsr_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index 0aca859c88cb..f669a226d728 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -84,7 +84,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, st= ruct sk_buff *skb) =20 /* Get next tlv */ total_length +=3D hsr_sup_tag->tlv.HSR_TLV_length; - if (!pskb_may_pull(skb, total_length)) + if (!pskb_may_pull(skb, total_length + sizeof(struct hsr_sup_tlv))) return false; skb_pull(skb, total_length); hsr_sup_tlv =3D (struct hsr_sup_tlv *)skb->data; @@ -100,7 +100,7 @@ static bool is_supervision_frame(struct hsr_priv *hsr, = struct sk_buff *skb) =20 /* make sure another tlv follows */ total_length +=3D sizeof(struct hsr_sup_tlv) + hsr_sup_tlv->HSR_TLV_leng= th; - if (!pskb_may_pull(skb, total_length)) + if (!pskb_may_pull(skb, total_length + sizeof(struct hsr_sup_tlv))) return false; =20 /* get next tlv */ --=20 2.54.0