Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1678684pxu; Sun, 6 Dec 2020 03:47:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYZp4TR2VEzZEPs6kWk4gqvOW1d4F0LmfaoYYOL3z/d7F8vvQ5IgHc8XV0Qoyc+FpICM1o X-Received: by 2002:aa7:c892:: with SMTP id p18mr15630011eds.64.1607255279246; Sun, 06 Dec 2020 03:47:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255279; cv=none; d=google.com; s=arc-20160816; b=tKQ1/qREaHbm24EiNqn+Tgd+OI+hMbh7hRaEDvRxkuZto4h3fAw/HSvp5OLH26JtoJ IGsUy1ZuWqLGhYt6OLSqdS40DHB0A/3ees5uNsPcN8+xfttxBjv03t4ZzrtC0C2mHwro edmIY3ZvqKhyGH9tp1J9nlXSDeqNgzoFUhZ5z+J2GmYo8sD2BF+cq4QMfv9GzN41r2HU B/+fP6JQTwAPel+T2o/6E/3lSpCLZvhQXNuj5ETjt9WTXmV+ESrznf8hoc3IWUq7189K 3MIKjf/tcnQN3+Lplur3le5rxiEnDzW5FaEBL5t2iKC9Vng8rRP2CKhXw1OktI8mAF9/ WAeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=K23KQoZC1KjgemRObWulP9WrIibWwB8jRPWKTAGzdC0=; b=eCkhk5/XqiKXtrH1EzYda60jygLEechH2BwhA9t1wrY/s+Ik1JJ73hCG848I3n8+lP fgS+v2nZzUIGyevGgfWuK5R3Ko/GeI4nuyczZiJl+CgkDkXjeopArLECqQObjoaRwFgr Pm9at3qYBheaHGQc+Z5i1kIYERStFJe4YV1sEuiVa9Sd49NExLZsjruc2xq9yiF2PZWx he/apQeLFnTYNVxsKw37RDMrQRg2gL8lRr1Kda3BSDN1qIQPjIMp9LU0Elx0FYCXGI9X /aBDxJiKcUv816gR8ljf8dGlOawoPRbSZvF6sfZog83bpsPV40XXK4RKvvpGdQCbzAxZ EpTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si4566789ejx.708.2020.12.06.03.47.36; Sun, 06 Dec 2020 03:47:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729186AbgLFLni (ORCPT + 99 others); Sun, 6 Dec 2020 06:43:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:43022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729172AbgLFLnf (ORCPT ); Sun, 6 Dec 2020 06:43:35 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davide Caratti , Guillaume Nault , Jakub Kicinski Subject: [PATCH 5.4 32/39] net/sched: act_mpls: ensure LSE is pullable before reading it Date: Sun, 6 Dec 2020 12:17:36 +0100 Message-Id: <20201206111556.223848207@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111554.677764505@linuxfoundation.org> References: <20201206111554.677764505@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davide Caratti [ Upstream commit 9608fa653059c3f72faab0c148ac8773c46e7314 ] when 'act_mpls' is used to mangle the LSE, the current value is read from the packet dereferencing 4 bytes at mpls_hdr(): ensure that the label is contained in the skb "linear" area. Found by code inspection. v2: - use MPLS_HLEN instead of sizeof(new_lse), thanks to Jakub Kicinski Fixes: 2a2ea50870ba ("net: sched: add mpls manipulation actions to TC") Signed-off-by: Davide Caratti Acked-by: Guillaume Nault Link: https://lore.kernel.org/r/3243506cba43d14858f3bd21ee0994160e44d64a.1606987058.git.dcaratti@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sched/act_mpls.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/sched/act_mpls.c +++ b/net/sched/act_mpls.c @@ -88,6 +88,9 @@ static int tcf_mpls_act(struct sk_buff * goto drop; break; case TCA_MPLS_ACT_MODIFY: + if (!pskb_may_pull(skb, + skb_network_offset(skb) + MPLS_HLEN)) + goto drop; new_lse = tcf_mpls_get_lse(mpls_hdr(skb), p, false); if (skb_mpls_update_lse(skb, new_lse)) goto drop;