From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 941CBC2D0DB for ; Fri, 24 Jan 2020 11:34:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 654752077C for ; Fri, 24 Jan 2020 11:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865680; bh=bdxtbrgnseGx16inRyQIv6YLr/3AdmcOXdYek/M70Og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=D1jh1aKeWPAeeyOxk8Dz9aS5sgM9JTIePSTdODZ1LzqSzTXO4Cmz79ktJuKWmUiOL yTAH0DEXHY9j1Hg+omafGT5Y3rh8zEuCKezuVyJpYjnYPVrgOrU0Ot7hnIupEaG3K2 YzTYG+FX/AEZaInOLYjVAt9xXtCnRFfExhC8Zfxg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404743AbgAXLej (ORCPT ); Fri, 24 Jan 2020 06:34:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:54494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390190AbgAXLef (ORCPT ); Fri, 24 Jan 2020 06:34:35 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 82885214DB; Fri, 24 Jan 2020 11:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579865675; bh=bdxtbrgnseGx16inRyQIv6YLr/3AdmcOXdYek/M70Og=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zc50qQthAHoNBPIOGreQcTTvlciJZTKgRvpF/mj7tvxKWMG9GIwSsAW21Zwjk4+fL aEnQBblJR7ihHw9CMrMN4jdrkinkZg+3zME2Q50zSgr2Jp4BFvWk28Zs81q2lZLhAa DHLuYj42qQn1YUm9GoU2FwxtV6Lo2lXWnEuxvpog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kbuild test robot , Dan Carpenter , Ben Hutchings , Jakub Kicinski , Simon Horman , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 609/639] net: netem: fix error path for corrupted GSO frames Date: Fri, 24 Jan 2020 10:32:59 +0100 Message-Id: <20200124093205.754524640@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski [ Upstream commit a7fa12d15855904aff1716e1fc723c03ba38c5cc ] To corrupt a GSO frame we first perform segmentation. We then proceed using the first segment instead of the full GSO skb and requeue the rest of the segments as separate packets. If there are any issues with processing the first segment we still want to process the rest, therefore we jump to the finish_segs label. Commit 177b8007463c ("net: netem: fix backlog accounting for corrupted GSO frames") started using the pointer to the first segment in the "rest of segments processing", but as mentioned above the first segment may had already been freed at this point. Backlog corrections for parent qdiscs have to be adjusted. Fixes: 177b8007463c ("net: netem: fix backlog accounting for corrupted GSO frames") Reported-by: kbuild test robot Reported-by: Dan Carpenter Reported-by: Ben Hutchings Signed-off-by: Jakub Kicinski Reviewed-by: Simon Horman Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/sched/sch_netem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 1cd7266140e6a..7660aa5b80da8 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c @@ -509,6 +509,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) { qdisc_drop(skb, sch, to_free); + skb = NULL; goto finish_segs; } @@ -584,9 +585,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, finish_segs: if (segs) { unsigned int len, last_len; - int nb = 0; + int nb; - len = skb->len; + len = skb ? skb->len : 0; + nb = skb ? 1 : 0; while (segs) { skb2 = segs->next; @@ -603,7 +605,8 @@ finish_segs: } segs = skb2; } - qdisc_tree_reduce_backlog(sch, -nb, prev_len - len); + /* Parent qdiscs accounted for 1 skb of size @prev_len */ + qdisc_tree_reduce_backlog(sch, -(nb - 1), -(len - prev_len)); } return NET_XMIT_SUCCESS; } -- 2.20.1