Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3615083pxb; Tue, 19 Apr 2022 06:38:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVZj/ZMWHNwJpMXvNDl4yY3MoHAxYUcn9IB3XiMNx+lXI7IVQUXsYQh5VoDuvfkEOHxvua X-Received: by 2002:a05:6402:448a:b0:41d:793d:8252 with SMTP id er10-20020a056402448a00b0041d793d8252mr17215750edb.6.1650375536184; Tue, 19 Apr 2022 06:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650375536; cv=none; d=google.com; s=arc-20160816; b=c+hlQGuk+5LFEW7Zzi6ab/fDcKyVp1OxVagwsVs883If3dXN5IQ5Enyeap2pjPrDoT 9s8n0ZqGwOT44aAYK42wUcFySoMPJO5PeHKpwVhuXQXgANavdCyl9ZjgVI8YZ8CJ5YF8 jm4Ppbt01aom5vE5PeQFuoSB8iWwj1VMKfjgmfAve+8EDff+ax1STimUhm9UdMlgrzfB goImfHKY2NW8/DsYhgqn4WrhdqosxZwWyWHQ1SfFGprrW3ArH08/9q/aPlKl/YBKmUA3 HNydzzW/szvK1q+/jOnGu5O5lfzErHSWw/KccKgxJaEqFU/N3bcU0VV6CF/4clT+KMOQ Vrow== 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=msD1cnnDHoI8g9leFhK3k+cGtG8SF1tLQhm1Bc/at/c=; b=opqRgn7DWKzYMRX+MQiF7yoO/JZ6h01OcUVNuClyj0kmYz9PVTm/P2Tbow8dZaXjXQ QCHVTWDex0CPj4cYyiXZic5FpepdOAjxpYkTQ4468CTjyajf9E7JSVdOY3x5OPgv061R NAQUgNx/OfNxwji/q006AN0YXjcAC+Eu5pgKZid6htp7Qd8bFttDjfITTw9xeNYJI9kn nUH5irqHJ5x6zUjKB3wQtTDWHrzD4Yf2d/Qw+BebagJHkhK8PFSY0aTSI+ZEG+0kO+eB kE3rDhsoALkvtuJBh+J+ZExyDRjRGMQU1mwGQZPvgLkCTNL9ncUwnnpSIKWDDQoZGHvX j7uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="GyLbVDr/"; 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 y3-20020a50eb83000000b0041d7e0fd44esi7570854edr.519.2022.04.19.06.38.31; Tue, 19 Apr 2022 06:38:56 -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="GyLbVDr/"; 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 S239000AbiDRMfq (ORCPT + 99 others); Mon, 18 Apr 2022 08:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239995AbiDRM3M (ORCPT ); Mon, 18 Apr 2022 08:29:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF0C205D9; Mon, 18 Apr 2022 05:23:02 -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 ABFBE60EF4; Mon, 18 Apr 2022 12:23:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D93EC385A7; Mon, 18 Apr 2022 12:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650284581; bh=7XTqroqFO/okzB1xM2ykxMbeDx4n0Pp7JOnf+IK9yyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GyLbVDr/MoIZ5LCSgsi4US9zLP57q3av4BHbDCBg7pKOrYlShtuhRYT2LC9mBu9oG uJ/A9Xfh9NRcDIo5BSlfTqwUy+cXBtODW6D6XuqaLxaouopTW6f/B0qsniMiqG18DV bh9kdKl8mBSJQSks5/iDFN93AqYKYrm/3RjTHLPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaomeng Tong , "David S. Miller" , Sasha Levin Subject: [PATCH 5.17 160/219] myri10ge: fix an incorrect free for skb in myri10ge_sw_tso Date: Mon, 18 Apr 2022 14:12:09 +0200 Message-Id: <20220418121211.362126379@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121203.462784814@linuxfoundation.org> References: <20220418121203.462784814@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=-7.7 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: Xiaomeng Tong [ Upstream commit b423e54ba965b4469b48e46fd16941f1e1701697 ] All remaining skbs should be released when myri10ge_xmit fails to transmit a packet. Fix it within another skb_list_walk_safe. Signed-off-by: Xiaomeng Tong Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index 50ac3ee2577a..21d2645885ce 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -2903,11 +2903,9 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, status = myri10ge_xmit(curr, dev); if (status != 0) { dev_kfree_skb_any(curr); - if (segs != NULL) { - curr = segs; - segs = next; + skb_list_walk_safe(next, curr, next) { curr->next = NULL; - dev_kfree_skb_any(segs); + dev_kfree_skb_any(curr); } goto drop; } -- 2.35.1