Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3319558iob; Mon, 16 May 2022 19:15:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCDWy7typf3s1fzawsqMqsJo7MEXb/qbfT5+6nvLT8GMvpHfskcYz/oi2gLIRNSd3k6Bgj X-Received: by 2002:a17:906:358a:b0:6f4:2903:417e with SMTP id o10-20020a170906358a00b006f42903417emr18080540ejb.592.1652753757041; Mon, 16 May 2022 19:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652753757; cv=none; d=google.com; s=arc-20160816; b=PGEv9y9wAAFkDqh81+VjKGUFmUZBLe1Whigpb9yubKIkFbryVQ5mEHnGzEEqDOFpbt rUWPvBsGIStKVn0cOlfqXX2DXBjZJESeUjGr6BZIR34v4rOaqb6pLtbyQIGAaETByf+R d2UB8Zxs5mKOmbGh2r3tNR8pCJtVoEWcD3ZQLFqBvNcwYQKiu6D37UAEyN08faB2BwJG aMM0JTclvPa8Gw49/EXGwoOW9q7tmM/9cX+2IrKVAWG79pBs1MaARhx66e+520BCRiJw 3p6Yj2fxJfwi/i2/YG7JDt7rXxXW0afbzEik0NMg84v5PJ764ps73pE8d7PC+00VGXp0 5rXg== 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=AW2VUFq1N+fs2BNs02J90MqqsU+lZdshRpfDgkN0OYY=; b=abL+Fcd6ZZGBayFEXXW4oxdxkfayoLr1d3pMIERlVELiZlS64Cy20Au36MUV6m+2T0 CmcEdm5YrYR2xbTusi7CQMNtpWVQJGMHw5bpALE0qk6z0fxfnHb76CvJ640ngBKZgvwi +Ib6W9twMZInouEZdaENMziqmeFpd6ur3aInEDHyby0j0HzqjPartpAxJeB5uUW8HVqn jpCsxhgR1f5KxHRP9Qc/ti9YMhBzsM10KLg9jQaYbqPvdOv81pKb3VONUMImuPj+OD6m GXn0JgBgxG1zgWd6dsDu3uJMkiECLy3rHd3HyM1QgZgh/q07r+yYRgy72pmNYQm7WC0T BEPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BjQLwOWW; 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 hv18-20020a17090760d200b006f3ad555460si1185394ejc.652.2022.05.16.19.15.31; Mon, 16 May 2022 19:15:57 -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=BjQLwOWW; 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 S1351492AbiEPUDq (ORCPT + 99 others); Mon, 16 May 2022 16:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347803AbiEPTwT (ORCPT ); Mon, 16 May 2022 15:52:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C9E8427F2; Mon, 16 May 2022 12:47:58 -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 D96AA6009B; Mon, 16 May 2022 19:47:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E67A4C385AA; Mon, 16 May 2022 19:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730467; bh=zw7+nG7mRK6zS8SGRZtV5iHlnpITV6OHXD5smvY6bZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BjQLwOWW1pcDcCpFiwQafgVnFSgwXpz1kDGIZgt9sxhmUcQgb1/vmu1Z88QnEh4KK YaZ1kclEuva9c2XrGFrABFFKTgjfMGA6u/MKtWh16ryRFacTFhcO63bzony/dr5TIR cHFdfPi6tjqoU+E0OCedIOPTpwnskof54YQqgjrM= 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.15 001/102] batman-adv: Dont skb_split skbuffs with frag_list Date: Mon, 16 May 2022 21:35:35 +0200 Message-Id: <20220516193624.033718995@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193623.989270214@linuxfoundation.org> References: <20220516193623.989270214@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 0899a729a23f..c120c7c6d25f 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -475,6 +475,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