Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp705356ybc; Sat, 16 Nov 2019 07:16:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxIl8MqJL7+P3yPpHOsTGiC73wuka4N6yp27K1u6yGrua9F7gJycdp+if81tI0wc67qLiiR X-Received: by 2002:a17:906:7750:: with SMTP id o16mr10628592ejn.224.1573917374666; Sat, 16 Nov 2019 07:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573917374; cv=none; d=google.com; s=arc-20160816; b=rpKmUL1Ii81i/kO/brGj93tUd4rOZYr4iAOpQ/gsfDlPUDuo47mrAxk+WDgdSAES3X iIbvjDqX9E75/8CN/Eb75u6Osv5ZGtc/ElRt5CUBlOxEM4Z+xUUGfyn10msh+2wqKmqx Ivj58PIF/pytBfiyumqH5AxJJaCTk0sFRLeQDZnA5QHcem2Fn+pFNCHoKn03dz36h2Up 4BVmtXqk2DCmsxV1akUIfSC6gWeCc5f2JSZraGOxMT1RzxnEc5RDDP8WXCQOdavwdDG/ muQH531XotIp8JUKUd/9LZzoxKLLS9iV9V93riog3JsB2JWqCycZBpvdboMhqEs/UTiF 8L5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pPlA4nA3B9PogJQ4NlpecHUm74e+1Xu2bPPH0HAaqXA=; b=asvuPzlMcXMIR9Z4m3evt+GQizRuBj56D1N5c06OX6rUQRhasFXbFX6qQW/CDbeVzc RALcA241kjbGP32ZpKcVa7IZCiXKQTB7mk+Bn4yFiQacSGRA3fC6Z72vdSCRGcVVK6Gr 2S9TWiIWW0i4Z7DvLoaBWBtjoYt3KiHGILzN6Ig0NjiHR2xkZDVGDmMLvRIr8/+h2QJn wkpdQcNj8Utw59XEvFlNl8ueAkbeCSeVYL4dJXXv3QyQ5MRinjiwJAdLH4q6tl+5JO2W E+XEISp+LjgQqWPdYXrXCVasbU7zpIB0cBqjo6ttyqTPEb/sQVEmg5c02kiQmH3dj5Si nNVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g13si9178299eda.292.2019.11.16.07.15.49; Sat, 16 Nov 2019 07:16:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=uniroma2.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727646AbfKPPNy (ORCPT + 99 others); Sat, 16 Nov 2019 10:13:54 -0500 Received: from smtp.uniroma2.it ([160.80.6.23]:54163 "EHLO smtp.uniroma2.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727777AbfKPPNx (ORCPT ); Sat, 16 Nov 2019 10:13:53 -0500 Received: from localhost.localdomain ([160.80.103.126]) by smtp-2015.uniroma2.it (8.14.4/8.14.4/Debian-8) with ESMTP id xAGF6RdA011419 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 16 Nov 2019 16:06:29 +0100 From: Andrea Mayer To: "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , David Lebrun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrea Mayer Subject: [net, 1/2] seg6: fix srh pointer in get_srh() Date: Sat, 16 Nov 2019 16:05:52 +0100 Message-Id: <20191116150553.17497-2-andrea.mayer@uniroma2.it> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116150553.17497-1-andrea.mayer@uniroma2.it> References: <20191116150553.17497-1-andrea.mayer@uniroma2.it> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.100.0 at smtp-2015 X-Virus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pskb_may_pull may change pointers in header. For this reason, it is mandatory to reload any pointer that points into skb header. Signed-off-by: Andrea Mayer --- net/ipv6/seg6_local.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c index 9d4f75e0d33a..5e3d7004d431 100644 --- a/net/ipv6/seg6_local.c +++ b/net/ipv6/seg6_local.c @@ -81,6 +81,11 @@ static struct ipv6_sr_hdr *get_srh(struct sk_buff *skb) if (!pskb_may_pull(skb, srhoff + len)) return NULL; + /* note that pskb_may_pull may change pointers in header; + * for this reason it is necessary to reload them when needed. + */ + srh = (struct ipv6_sr_hdr *)(skb->data + srhoff); + if (!seg6_validate_srh(srh, len)) return NULL; -- 2.20.1