From patchwork Wed Sep 1 12:26:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 505690 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2CE1C432BE for ; Wed, 1 Sep 2021 12:27:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A9DB61056 for ; Wed, 1 Sep 2021 12:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244401AbhIAM2u (ORCPT ); Wed, 1 Sep 2021 08:28:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:58304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244355AbhIAM2i (ORCPT ); Wed, 1 Sep 2021 08:28:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3CC1B61056; Wed, 1 Sep 2021 12:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499261; bh=oMNdOFcODqgT6YXrxT7KNp0IYA94EmPaYofyCQyUO4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfgTBRdl5Chdlps5iwU60xqy+1/bwssWoDMcxseL8e8Fn2C9/xtGqIiPz3L/zkYsE 0Ib6NPPLK+VvZxLS5vrkc92kSCO8r30s4zY6YunR0gaVOp6LLh5U5Uoz0l5CNr38dP 6qpXG1mBdpAtMEv+uw6xg9rzFw0pClctfTgy6qDE= 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.9 08/16] ip_gre: add validation for csum_start Date: Wed, 1 Sep 2021 14:26:34 +0200 Message-Id: <20210901122249.175416760@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122248.920548099@linuxfoundation.org> References: <20210901122248.920548099@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 9609ad71dd26..fe1801d9f059 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -353,6 +353,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); }