Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2204781pxb; Fri, 25 Mar 2022 13:01:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDo0RIwR6xXZ47gtzrueQvTLuGL4iSM1Zw7JPyRc65kQDMT34OaXun4w7eNL0+Zh4p1nTP X-Received: by 2002:a65:45c9:0:b0:381:783:19ac with SMTP id m9-20020a6545c9000000b00381078319acmr943075pgr.119.1648238463060; Fri, 25 Mar 2022 13:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648238463; cv=none; d=google.com; s=arc-20160816; b=0lujTSekTALYYw1iU91x1LgfyRb2cb4vj2FD5F6yMk+rwA/0ZrSJqksDcsfai5+NKf 2znGAekwptrjrwPNHMKBe6jmHmq10We1wvRje7d3v5/dd/qkBwiccOiB1Zz5Urvt05u3 ay9Ns9GvswvgHa/oa7fGRaMpRMR/A/zahuwUXqbcyYFe2o8hvquxVAQn0rG1cXnx+mv9 oSS56C2d/nmp4tME3Stxh0d9N1et1xh5OCK3GhCNO3hESIOg1Uiu2h1K/APHIysX1VZg WkBrajct4QHWc/FAXr0HRPXGLcNHosSIYgIBvpakhxqgVlmF1vXNWM3uCZJJodZRKX+F VEEg== 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=KKrsRSuVIoN64ZQQg3TGnY3xPjKGnXqCscfVd0N2w8k=; b=X9ueaU3N9lLmpYrQBkvn2Fh+Zg4VegYYXUVWn1dKlepT0469izBBw8NBKgmdf9XYpS k0FKRlQIa6PJUuNIkNdQ9WHU/+e/UaunjFMmEjSf80WRMNQEYA6gvzzHse1VmFwZ2x5h 1sBBuwS1CPkSrR4J03rfVsEfiWnLH8GT/k6+MdgnokkOEdvGgF7NhEq/F5xdu7DrOZTo 9xnjUzFXjRVKWYufrF/k5l76bMOSzyyslooBJRhjtCtVxKswL3YklrekpTo1barc0sSV SrGo9buQD7DYHELbBXPzhzQJn0r9+aH8jsT/0RbWh9WYMp5uU66H/lGlH6dvnbSAWv2x NFHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W5pZNVJz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p1-20020a639501000000b003816043ef72si3372657pgd.359.2022.03.25.13.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:01:03 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=W5pZNVJz; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E0E0137B8E0; Fri, 25 Mar 2022 11:49:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376276AbiCYPL2 (ORCPT + 99 others); Fri, 25 Mar 2022 11:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359692AbiCYPHv (ORCPT ); Fri, 25 Mar 2022 11:07:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6F64DA6E1; Fri, 25 Mar 2022 08:06:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 53C9961749; Fri, 25 Mar 2022 15:06:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B5D7C340E9; Fri, 25 Mar 2022 15:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648220760; bh=b3wLxvBN8R6Bi6X4L+bptNebRNxT1fSpfIUs4tO0WkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W5pZNVJzNm+lbXzZ9TeHCVkKXwd9rxLbmx/7JNiDqfg2qePDNccPB37A1BJX34oAi VLARiUwYuxJ1JxuPJNAC4tJXpzGnB89MJ/rzWXj4qwDOm3a3v64rbFIaeGoFNqHvuS x6c0iOxOMKgyiMD6Nr8Fyk96ZW20YRgDKDt8myAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+e223cf47ec8ae183f2a0@syzkaller.appspotmail.com, Tadeusz Struk , Willem de Bruijn , Jakub Kicinski Subject: [PATCH 4.14 02/17] net: ipv6: fix skb_over_panic in __ip6_append_data Date: Fri, 25 Mar 2022 16:04:36 +0100 Message-Id: <20220325150416.831293702@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325150416.756136126@linuxfoundation.org> References: <20220325150416.756136126@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tadeusz Struk commit 5e34af4142ffe68f01c8a9acae83300f8911e20c upstream. Syzbot found a kernel bug in the ipv6 stack: LINK: https://syzkaller.appspot.com/bug?id=205d6f11d72329ab8d62a610c44c5e7e25415580 The reproducer triggers it by sending a crafted message via sendmmsg() call, which triggers skb_over_panic, and crashes the kernel: skbuff: skb_over_panic: text:ffffffff84647fb4 len:65575 put:65575 head:ffff888109ff0000 data:ffff888109ff0088 tail:0x100af end:0xfec0 dev: Update the check that prevents an invalid packet with MTU equal to the fregment header size to eat up all the space for payload. The reproducer can be found here: LINK: https://syzkaller.appspot.com/text?tag=ReproC&x=1648c83fb00000 Reported-by: syzbot+e223cf47ec8ae183f2a0@syzkaller.appspotmail.com Signed-off-by: Tadeusz Struk Acked-by: Willem de Bruijn Link: https://lore.kernel.org/r/20220310232538.1044947-1-tadeusz.struk@linaro.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv6/ip6_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1321,8 +1321,8 @@ static int __ip6_append_data(struct sock sizeof(struct frag_hdr) : 0) + rt->rt6i_nfheader_len; - if (mtu < fragheaderlen || - ((mtu - fragheaderlen) & ~7) + fragheaderlen < sizeof(struct frag_hdr)) + if (mtu <= fragheaderlen || + ((mtu - fragheaderlen) & ~7) + fragheaderlen <= sizeof(struct frag_hdr)) goto emsgsize; maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen -