Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2221142pxb; Fri, 25 Mar 2022 13:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFI9e4BzXtTKtkQyXNW7kSIjbDinzp9b052Bdk23eCSoLEMiGzXALFEb7YdP9q6Cdlx+7G X-Received: by 2002:a17:902:e5c6:b0:155:ceb9:3710 with SMTP id u6-20020a170902e5c600b00155ceb93710mr7580635plf.59.1648239538325; Fri, 25 Mar 2022 13:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648239538; cv=none; d=google.com; s=arc-20160816; b=lDLJPhRbbUcAFkPw+9IZVF0YUR9D0Y88ncvZuu8nFWA2XwC6KVjjFQWisgnVy6DGhq oIWFjOCx3MnqB+2hnqKTWzfQsS8hSpkEE3dsvOY17rM5fXPdca7LNw3mHFJ7pHlkEY6y yRmoLUsPhIIwwb45I5ADMkGZGK13pR4sZsViJYPJ224f8XgiSbvE+uNEYxv2mYIX4LFx xQLCclhRsCQNErk7jxGYTEKIC4PL/MRpjJitZ8GQYqBWfTKFDo1qDyS4GegrOtUwqMIm A6T/iNzvbw3nHNHVsIEMF+Yf/Xyw3C6f1v7myNEOMz+BBBQEUNNPU2wynHxf9PYw+OD/ Oy/A== 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=vI+U3fdZXPyw8yHHQr3Z/tv4W667JLozNiUw7lJ8VX8=; b=SMCDYTPV5S0Y3m3SEWIzZ3bN7JQhIuXBCfR3WO08AmKwqU8kg9SZIH/Am+kF0Y3ncI /RqM0368Byz3Y2TjIdMeMzf9ON0MKsg+rARoCh5epMvN9j/ML8SFmdkJUsqNMjTIMTi4 9Z+0aOJkg6OHK4/95AqMtHKXrxg1EmmQ8HLBkCjdbW1Uc1gKaFCTttaT+d55C6PyjElB LkHJYP879jnhwx53sGBbHrVbpPSJTJMEET/EnVjSVVyZbKWST8qudMl64hzVX0EojAdq KA4iw+8qYxC5klbEysQK5KmI/tVt+6cepVbwpgFZ1hty2s0o0qSMjhxVN7IRnFSKTi5j t67A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1NgHKRuh; 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 bm20-20020a656e94000000b003822b0c24ddsi3521887pgb.836.2022.03.25.13.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 13:18:58 -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=1NgHKRuh; 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 3509D3AD650; Fri, 25 Mar 2022 12:16:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377258AbiCYPOF (ORCPT + 99 others); Fri, 25 Mar 2022 11:14:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359864AbiCYPLH (ORCPT ); Fri, 25 Mar 2022 11:11:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7644954FBD; Fri, 25 Mar 2022 08:08:20 -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 ams.source.kernel.org (Postfix) with ESMTPS id 5D290B82833; Fri, 25 Mar 2022 15:08:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9798BC340E9; Fri, 25 Mar 2022 15:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1648220897; bh=hqD+dPwNLrtazDnJ4HTJwwjM8CPwowrgBplh6HZ9cuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NgHKRuhdRJPiRVhfT1Prs4WnYH44oKHsbVnoTsBUtnr+ifbWrS7ASWgI5zFUViH6 hJfl4VMex5Tj0RBNUFYM7osirPr5+yKvzSuM2qZU1xsfq0rrN3Axur54AMh4d2thhC ocvnuuGtqaeKJWaOLwhLGZ63z/v8IRJvmCyg2lko= 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 5.4 04/29] net: ipv6: fix skb_over_panic in __ip6_append_data Date: Fri, 25 Mar 2022 16:04:44 +0100 Message-Id: <20220325150418.713387530@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220325150418.585286754@linuxfoundation.org> References: <20220325150418.585286754@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 @@ -1429,8 +1429,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 -