Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1678338pxu; Sun, 6 Dec 2020 03:47:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUcjKQrnpbu6xB1gPWnHC+aGD3gO8lpa/Ys1EqM4IbWwk6NM1uPH9T4UzBOQvnFxf6x2Bl X-Received: by 2002:a17:906:b104:: with SMTP id u4mr14735975ejy.121.1607255223124; Sun, 06 Dec 2020 03:47:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607255223; cv=none; d=google.com; s=arc-20160816; b=czTYjVb7dXdfCV28jyCeIJ3st1dcRG5tVUC3d4NQf5okYebLlsSpHcm2AmJTXFN4LH seoi2LpCBBDOa+Fz2dwxeu3H3lwgy64Cnakmhv+BTlwd4qTm3QaE4fBHlGymD/XvNkJ3 54VrjmO4dmbe1eSRu5bPAFWfd3O/FQHP8HOGtREMPoB/ekGmsps1e0u2IEJe3rT5A35u 6ycb2bU5OudlE5Jgv2hOsv0Zf4/xCNfwmxqKE/ptsNiHxfQHKTocJa/NmHNwqlR+xJJG +kJ0VbHPbOlLhuv2lXNLMP9ye6QsgDPnhv44Dz0QojjWMLcd6YaWAPnXy57XmAt06ttP qEaQ== 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=O/bezYkFBMlXPeR6LedWBgq78/mMMOfnQiWPH7GNuem0GSz1XNt/g73NemXiPsdaT9 FtuzUza+jsvM9SAEbq2+MsdHaS8XzW4qvsM+ssSdhrDcWOm2c9KFrHeh/azKQelisxSi Q4P0E+YqbxlqY6tIrT0X4zQl0FZB4KZkXmyHJe25JpVpLo9LLtAEf30KXIPcizOCAFL+ zitp9w7y7W2NoW/uKfZCTxZz7+aLv52nZk+JiZfBB3AmDTAaVLiOpcX82ZagLwkB0vCE brJhsR4IMpFhKgwPuZyCve6ImMhFwdZErNDzWRP51I2dFbEl6FjvmIdknImGhVhTKuF7 aWBg== 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 by5si4712926ejb.717.2020.12.06.03.46.40; Sun, 06 Dec 2020 03:47:03 -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 S1729436AbgLFLpB (ORCPT + 99 others); Sun, 6 Dec 2020 06:45:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:44440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728809AbgLFLo6 (ORCPT ); Sun, 6 Dec 2020 06:44:58 -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.9 35/46] net/sched: act_mpls: ensure LSE is pullable before reading it Date: Sun, 6 Dec 2020 12:17:43 +0100 Message-Id: <20201206111558.149317835@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206111556.455533723@linuxfoundation.org> References: <20201206111556.455533723@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;