Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3511096pxf; Mon, 15 Mar 2021 11:09:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuGjpD6/QBSxJdeg3tOFC3iQC6Tftn4KTZnXimpLzzawGbCvu0MEiy9zXgIx7Wjq2vlzmv X-Received: by 2002:a17:906:1d55:: with SMTP id o21mr25143779ejh.485.1615831753610; Mon, 15 Mar 2021 11:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831753; cv=none; d=google.com; s=arc-20160816; b=W7s/dqWrF2uUdKK2TPFVXXkPoz4m/OfYlTBQAzT6woxdlfRvXupuM9+U6ssd6Dz1qy 3z525oZ3xjsKsMhZILMYXPIs7y35AQigwNJ7AdHudvcAr0vfvUGRzlGvsZP+SZ+KPF8o SaZyC/Aax832T3ioj+HAQ9Ht187ZHShIge5obU0Ed/ffq853JJPqraL6gLYo57sKrVTL NZfz9OH9UYW88l6v1vXPHVKlkj5pfoPx4FL+wWG5wxPpJsfvrSyi+9VUCe3wwepQI/sT 0RsbiCqzK490Kv43kPlzhKuYV8xHh15On0XZNuL0f0G6KoccqrYhCMQ/394c+AOueiZU HBCA== 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=lSXDtVropSAIeYxgOLoedqtc+KnfjFUhKKOddu0jRoM9HGFD8CiytPks+zqfwpjklD Ei5R0l0GNsOiAmCIZ3IbUzFm6WlTtJeSpN8uN6Px9bfDyoIPfmWGAVy5IwsK25JTy+pZ QPUuC0HODLUdYyPcmszsP7+yRSpxKF4dh2X56HzXDUPwokw1whb47jiF+8Xk+//tu1Ly nyocRMWzNm1wVQBxkrkeAWjq1Vbdebuk4GYbjewL2exkAJfYhtSDYMKO414decXw8DDD JZQXWVZtcTNzalj99xUA4AIoknCX/178DBYyr4UBJBSFGUmUoCejzC/bNrFfH2kW50mr F5PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zsVHfcXf; 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 q16si11575999ejd.145.2021.03.15.11.08.40; Mon, 15 Mar 2021 11:09:13 -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=zsVHfcXf; 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 S232033AbhCOOJ2 (ORCPT + 99 others); Mon, 15 Mar 2021 10:09:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:34930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232154AbhCON5w (ORCPT ); Mon, 15 Mar 2021 09:57:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1555364F41; Mon, 15 Mar 2021 13:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816672; bh=61hwE0aosy0oCTorMejB+6tfBdUSKc8uckX85DtWClM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zsVHfcXf+4Cx2237AuAVaT8gTAYqabcF1lEy4dCfJqpkchLFaZjMvbxBut+6Hv/jQ D5jghqHa9SPheMo3Dz5DKgqLuRwiktKKGc429Jyd07hjOi2f9Fuf8OUOS9i2GRttIp DlVj5AlpL3Sjo1Ju5rcCozCZFrV7xw4Uaw0dSskI= 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.11 055/306] net: ethernet: mtk-star-emac: fix wrong unmap in RX handling Date: Mon, 15 Mar 2021 14:51:58 +0100 Message-Id: <20210315135509.511797491@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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;