Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2089377pxb; Mon, 12 Apr 2021 14:09:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzS/GGNBExS3Vu1D/JuoDEDJy/3RZkXoDWIULTbHZ+RQim6oToUsz6qujjBvKbT37FJbzll X-Received: by 2002:a17:906:8317:: with SMTP id j23mr20751207ejx.13.1618261788097; Mon, 12 Apr 2021 14:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618261788; cv=none; d=google.com; s=arc-20160816; b=OnGNkFLR4/Wafdt6eAShixbIwgdxsYv2Rck+ghhgwar6pYwvcRTgzUhyxhbF8J2LjN WU2JBLa814zYTtU2cdvE/qH1FadOMrvirWxXc9KN+qJlv7aMA6pyx2qrIJrhaHwPhOfm Zd0KqnxDXv47B/j4hTbXx7ylQViKyLLXs+Iuwxwb64k1vTVjeAsRdLeZDb1sRNolN11/ AFeo0l7H5Bv5oBgkoMJJ67nHc6r9st7R+pETPF6D2TZXrdjb128aLbj3sHdwJXQPvTEa EvYbX3Zc+svam+YqM+6EoLH7UlOzJYEYEaOCMkUFi6nf5wKRvWlGCIgXa6AwEe4dYhDS jSAQ== 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=wyGzpneYO0cNcWEJls23k8Ku6anXKHCdnH+GO6xumFU=; b=IK4KAnrA0Z+9YlX6UB5rw5V+JxNcEDxlNoxZAGCXCmTzo5lDaUxV6E1lSPIhzn4R3J gApqUrO4MoVQgiw21yCCUoI6frhCcacyztDI4DsaMOPDcnEdMSkwZi13p+zxGsuxE1hm c+YjZ48ZhmcoUbgVBFCK5+gqPG1vyI9t2xICZ/NGbwYtf5dEwYwh2JSwQMy3zaa5G7XL cCVnF1iZZ6jnPbJgDjf3urdKHPhElnpBq+cwe+3NRFfYCCwJF/WlACR3aLawNchH2xi5 wBlTrpac97+M8MB+7nx1JHamZXaNU6bmhvqVgV5yTfWXsi0ASI6j6ovJ7T5n8AknOapm Aldg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AXHLFXGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si7781705edv.218.2021.04.12.14.09.25; Mon, 12 Apr 2021 14:09:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AXHLFXGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S240613AbhDLJKq (ORCPT + 99 others); Mon, 12 Apr 2021 05:10:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:44464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239076AbhDLIze (ORCPT ); Mon, 12 Apr 2021 04:55:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A84D160241; Mon, 12 Apr 2021 08:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217716; bh=NVn1Bh8Jj5naMznwxoRD3JVNXnKAuTiarNUyiFAbH9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AXHLFXGPj606m/LKYv275ELVYmw7MAtkLhEv7tCpY0/0u7a96qvIv8iklIyTLvnCt zA2HfK+9Ts1k96eo6GOZc4BtqKLrG7+BgN7OK3ezG2AiNVeeAcF2IKWiq+HdcpMbXM PV0Qb0d6LBEpf+nuXhRVcCcNoMcweWPRf50Qd0LQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lv Yunlong , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 119/188] ethernet: myri10ge: Fix a use after free in myri10ge_sw_tso Date: Mon, 12 Apr 2021 10:40:33 +0200 Message-Id: <20210412084017.609447378@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lv Yunlong [ Upstream commit 63415767a2446136372e777cde5bb351f21ec21d ] In myri10ge_sw_tso, the skb_list_walk_safe macro will set (curr) = (segs) and (next) = (curr)->next. If status!=0 is true, the memory pointed by curr and segs will be free by dev_kfree_skb_any(curr). But later, the segs is used by segs = segs->next and causes a uaf. As (next) = (curr)->next, my patch replaces seg->next to next. Fixes: 536577f36ff7a ("net: myri10ge: use skb_list_walk_safe helper for gso segments") Signed-off-by: Lv Yunlong Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index 1634ca6d4a8f..c84c8bf2bc20 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c @@ -2897,7 +2897,7 @@ static netdev_tx_t myri10ge_sw_tso(struct sk_buff *skb, dev_kfree_skb_any(curr); if (segs != NULL) { curr = segs; - segs = segs->next; + segs = next; curr->next = NULL; dev_kfree_skb_any(segs); } -- 2.30.2