Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3359647iob; Mon, 16 May 2022 20:37:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/SHafETV4iSwLvcf2FX+Bl9PtTrj4VXwX/0x1hYmTvB1lV60Jsuq4ZaTBv/B2A5NS/tA7 X-Received: by 2002:a17:907:9808:b0:6f4:5e18:2192 with SMTP id ji8-20020a170907980800b006f45e182192mr17254759ejc.43.1652758634248; Mon, 16 May 2022 20:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652758634; cv=none; d=google.com; s=arc-20160816; b=ECjtd6iFRYEC1ADK4vXGzKGN70AP3LhHPKZQIGDtAM25/eRadzpOyOtPa/wpwmKBni CqgMBixhTVOoD20H3Ry2hy0JPLZGQtwSLwYTZHXea/aJyUh8vwYvnw29wvnoK/KTF39P MqDPNk6SZHpv8fuf36v+jLq9KmTjozCLXmWUNO8YsJ2DynYEX5u3EhfLtNLlNT6h7qo7 f3xp203HUKbw2FAqOqjIJNhuoxU1cOnnA8y0yGkz+s9sFQZQ0myh4hYZTwqW+ENb0CrW V2zafId1H4YGnhQ9QcJI6HS69VfEgJrEGKITlxc8r6IMdbgosCpNHispn78D6Mwx9Vyp /fHA== 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=ZW6bHjSVGo9FNjHw2ksm8NMzyTNFKBHoa524mW1drbs=; b=zknEaPP137Rgi6P1X4Cub1MX/rDrFXiTZ1rr+NaL7PVakUb15W5ZuK81HUEssz3T9d 1BEa9oiqaHDGXSL91F9RVwGwDAHjxsWE8sOiJcul0ZyBcqX0tOAn0UB0afZYn5o7/7xg 7HiljpPUSC9S0jvNsloIqor8cHEhdoq25ammKDIf07fpwNFPjwXzbLzPtHm1hyy4vleI OaGj3NUJ5NSzK9BedL6VZSNLCYwWViyaIh83Hht8u6yiMm5Lr1+3Gky0q1ekV4WsLWLk XgaTVtJ4N4ehjf6QNlAbdFi3UtilWImQWyvsj3i/+mRuIi3PL3hIVlKC4Tn3HpdXEXNR Xr0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cLVeVjzo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a056402351000b00425e87ced9esi13819572edd.512.2022.05.16.20.36.49; Mon, 16 May 2022 20:37:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cLVeVjzo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1346501AbiEPTqU (ORCPT + 99 others); Mon, 16 May 2022 15:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345916AbiEPTnH (ORCPT ); Mon, 16 May 2022 15:43: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 AEF183FBE3; Mon, 16 May 2022 12:42:13 -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 680D3B81604; Mon, 16 May 2022 19:42:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A48D8C385AA; Mon, 16 May 2022 19:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730131; bh=ya7PbCJHtfiYSi79Nbl7lWsnp8QokfAb541tZxyhNCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLVeVjzoEuR1eoOyKH9BgFy8MhF3Nu+HZXi7S8EMoMhP61SeFKWySsCwedjzwdiWG OxRQhk+T60EYfC5Vf24Bm9gf9DJuHTwB8ZWk51RdTbdExwOiY6Mc4BgeQxE5c4CWSN O5bU0gUkMhlqFKHdKHjTwplpA43/0HqvVfx7xaHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Kaechele , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 5.4 01/43] batman-adv: Dont skb_split skbuffs with frag_list Date: Mon, 16 May 2022 21:36:12 +0200 Message-Id: <20220516193614.760369751@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193614.714657361@linuxfoundation.org> References: <20220516193614.714657361@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Sven Eckelmann [ Upstream commit a063f2fba3fa633a599253b62561051ac185fa99 ] The receiving interface might have used GRO to receive more fragments than MAX_SKB_FRAGS fragments. In this case, these will not be stored in skb_shinfo(skb)->frags but merged into the frag list. batman-adv relies on the function skb_split to split packets up into multiple smaller packets which are not larger than the MTU on the outgoing interface. But this function cannot handle frag_list entries and is only operating on skb_shinfo(skb)->frags. If it is still trying to split such an skb and xmit'ing it on an interface without support for NETIF_F_FRAGLIST, then validate_xmit_skb() will try to linearize it. But this fails due to inconsistent information. And __pskb_pull_tail will trigger a BUG_ON after skb_copy_bits() returns an error. In case of entries in frag_list, just linearize the skb before operating on it with skb_split(). Reported-by: Felix Kaechele Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol") Signed-off-by: Sven Eckelmann Tested-by: Felix Kaechele Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin --- net/batman-adv/fragmentation.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 0da90e73c79b..f33a7f7a1249 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -478,6 +478,17 @@ int batadv_frag_send_packet(struct sk_buff *skb, goto free_skb; } + /* GRO might have added fragments to the fragment list instead of + * frags[]. But this is not handled by skb_split and must be + * linearized to avoid incorrect length information after all + * batman-adv fragments were created and submitted to the + * hard-interface + */ + if (skb_has_frag_list(skb) && __skb_linearize(skb)) { + ret = -ENOMEM; + goto free_skb; + } + /* Create one header to be copied to all fragments */ frag_header.packet_type = BATADV_UNICAST_FRAG; frag_header.version = BATADV_COMPAT_VERSION; -- 2.35.1