Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp875932pxb; Wed, 1 Sep 2021 11:52:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8jZZuRW0PWDGvVwZ6zakrjb/xxhzHRR6exn9MzBjL5JNo696iqfB+KH5y5ZQlDLmisDGk X-Received: by 2002:a05:6402:1011:: with SMTP id c17mr1043662edu.144.1630522368112; Wed, 01 Sep 2021 11:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630522368; cv=none; d=google.com; s=arc-20160816; b=LBL3qVu8UxpPeSEX8ZYWDGvWusvxL32l+4MuNokWQxiIVzyXcnzN2OXtOXCNECi7Mb deb2FNxhfz/za73WxzlfHk4l/+nmRi8JqLwJToghjowtMiFdMH+6dtF1O+Xu4KDZAOoP xYzA4efu0mC/KDmIilbzzyFRl1rUs/VEQUINNWePYmLKrwgBtrW7TIYa/HNCrnMoj+Sv En4brsVym4gs1m79g5b0WOZoeVNkPgytsW6TgxoTHTzIUuH5HyRMEh6Bpe3+zo3bLBnL ldddwK/M1+Ncxqbbb96mJL98stFhV4bLyvQDOeR2Et+yrYaVraoVP9NVeytMG4+rLvpR MXQQ== 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:dkim-signature; bh=Zb6QoKdfbKyi47TK8LW6ZCiqUmdafVQb/RxcdpgBvvw=; b=hhCdYA6UY256kwLYMUu4cyFeMifAHqabDYExuetgV5+gOk1UcDIAlpR/V1KIcVFDY9 FUmLoVlAv7hAmNyMGjM5k0JfkgRxxiAEMkMEdWkMmjz8nZqwVRFFwEtOLI17+Fo/8MOs 8v9vjni4yI3tMkRFo/D4ao7cOTVZWSVt6wu6/Arul0D4QALAUFzt82gUSBZB+aA6a1nV CNhnl2IgH70s55hkYwOqu7jAqOuQ0TBsWxV1CC4RL1HJzVR+c+ugsfIsdBU6xvoOfhao 11RfK2RF2Zo7vhOtVJKOILZs+zCiLqkPMjLsOKSvxd0JpW12XKvX7gATLNZon5usFQBk e/5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="twPk/0H5"; 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=pass (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 13si650506ejh.534.2021.09.01.11.52.24; Wed, 01 Sep 2021 11:52:48 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="twPk/0H5"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244725AbhIAMas (ORCPT + 99 others); Wed, 1 Sep 2021 08:30:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:59364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244418AbhIAMaA (ORCPT ); Wed, 1 Sep 2021 08:30:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C0B96101B; Wed, 1 Sep 2021 12:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499343; bh=zlhCOirBHcRPc+FT1T3bsIBUJ0ZW4Zrh3JIDaDaiV+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=twPk/0H55lF6QrUnYU+1cFX6juqn9gg9shNpl4Xobf+JlUupfxGYd8sZf/kWca8qy mVDigkFb031PB8QS97Whl66VFVQkeIEE3t5o9hnPIs1I/czX8bE2ZkD/QU3Iyugfem 9867vIVLQ+C6twFCSBUwu3zNIXgVqlD1bK/X/RUY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ff8e1b9f2f36481e2efc@syzkaller.appspotmail.com, Shreyansh Chouhan , Willem de Bruijn , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 09/23] ip_gre: add validation for csum_start Date: Wed, 1 Sep 2021 14:26:54 +0200 Message-Id: <20210901122250.086546902@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122249.786673285@linuxfoundation.org> References: <20210901122249.786673285@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: Shreyansh Chouhan [ Upstream commit 1d011c4803c72f3907eccfc1ec63caefb852fcbf ] Validate csum_start in gre_handle_offloads before we call _gre_xmit so that we do not crash later when the csum_start value is used in the lco_csum function call. This patch deals with ipv4 code. Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.") Reported-by: syzbot+ff8e1b9f2f36481e2efc@syzkaller.appspotmail.com Signed-off-by: Shreyansh Chouhan Reviewed-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/ip_gre.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 9940a59306b5..1a4d89f8361c 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -443,6 +443,8 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev, static int gre_handle_offloads(struct sk_buff *skb, bool csum) { + if (csum && skb_checksum_start(skb) < skb->data) + return -EINVAL; return iptunnel_handle_offloads(skb, csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE); } -- 2.30.2