Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3512720pxf; Mon, 15 Mar 2021 11:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsvf4hiFyvdA38G0YUpYqatX6uzSV7qEZ+JH0Vu11fGHxu0uaimJjOKYZ1lZpMXQE0rr9D X-Received: by 2002:a05:6402:3049:: with SMTP id bu9mr32088100edb.104.1615831890080; Mon, 15 Mar 2021 11:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831890; cv=none; d=google.com; s=arc-20160816; b=vPJ9/ebn8KrAsJGXnpFZ7EDz8Ax1R+FSlpN9vlp52D2G4j4/WAWIhA8ZKUnAVgAP63 zaM83QT+36UoIVs0kOME2/lXa0k0oTAGQctdlaVhXn2UzfIb3HEEwGcYihKDoYGkYXtH D3LFwOLzmJnRzfeyDsROvc2MPeBrkG2vljLqsyThM3M+m9pzMKffAs/7JyhMWsUq3olq iPF3UO+vLVSqkUnPXbOFmRafpCJCRwxxDmqY0HIqlY7brrQbJzIIU3eiVy46rO2NGYTA elmZZFq0m1o8mO2Y9gMujE4nOzgdzWSBm0iibkKv+GYnRYjt+ntlPNRzFghrK33+LTrc Y9+g== 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=MFMHbt6jxW8siL4aYJ8HqwNcfzUZUSmWulkq+YhtmXM=; b=ovASKfvHZR1e4z6TEgAO5bKzfPGnME3TqWCst2B2GXLAHvklP0kNkcb6Z1CJLO3HHm wKN2qVmCCZTI/bybyVXqDROVCuWw+tsRGOc7VVddB+bedhzsJVqzljILUqC46OezFouD JSnhQkbm1jTVR2Sh4iPa5SAM0D1Rw5d31jtjgEfo889G/x+ScEPJV8bo/2t/PZRBGEfO Rc1ZE9xuMgCSZHLxeVsVTQPATh2/CrwMKP52Fbi1re1giK5bByyn1YvXCCauqLx9R/lB fhS9NgXAAGztHMQprSlAqP7DhDwb1wwp1G0A7jJPh7YTcRd9APeX3lCm2T5NAHbGH168 LVRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cMewzX6U; 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 g3si11509769edp.527.2021.03.15.11.11.00; Mon, 15 Mar 2021 11:11:30 -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=cMewzX6U; 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 S235856AbhCOOLZ (ORCPT + 99 others); Mon, 15 Mar 2021 10:11:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:35090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232122AbhCON5t (ORCPT ); Mon, 15 Mar 2021 09:57:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C2EEC64F3D; Mon, 15 Mar 2021 13:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816667; bh=61hwE0aosy0oCTorMejB+6tfBdUSKc8uckX85DtWClM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMewzX6U842sT/jSRM1KRnIynCZnSZ2WJYLVc+T9TMOshEvSH9adCeTzIhPoLHvI/ xlbCPmMgEaoGC6IwUpDI0woELNrKjaueRp61xmJ8AHHtF2TaiMEhZUGa7yl7felUXK 6YX1oyFUzt1pVAQVQFbVyiOveDA4upAzm3LKwMIQ= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biao Huang , "David S. Miller" Subject: [PATCH 5.10 044/290] net: ethernet: mtk-star-emac: fix wrong unmap in RX handling Date: Mon, 15 Mar 2021 14:52:17 +0100 Message-Id: <20210315135543.414029009@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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: Greg Kroah-Hartman From: Biao Huang commit 95b39f07a17faef3a9b225248ba449b976e529c8 upstream. mtk_star_dma_unmap_rx() should unmap the dma_addr of old skb rather than that of new skb. Assign new_dma_addr to desc_data.dma_addr after all handling of old skb ends to avoid unexpected receive side error. Fixes: f96e9641e92b ("net: ethernet: mtk-star-emac: fix error path in RX handling") Signed-off-by: Biao Huang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mediatek/mtk_star_emac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c @@ -1225,8 +1225,6 @@ static int mtk_star_receive_packet(struc goto push_new_skb; } - desc_data.dma_addr = new_dma_addr; - /* We can't fail anymore at this point: it's safe to unmap the skb. */ mtk_star_dma_unmap_rx(priv, &desc_data); @@ -1236,6 +1234,9 @@ static int mtk_star_receive_packet(struc desc_data.skb->dev = ndev; netif_receive_skb(desc_data.skb); + /* update dma_addr for new skb */ + desc_data.dma_addr = new_dma_addr; + push_new_skb: desc_data.len = skb_tailroom(new_skb); desc_data.skb = new_skb;