Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2319912pxb; Mon, 20 Sep 2021 18:43:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwiQjVM9VVprn1H/FLWfOnJO900hrjYXV1UhQdHVuF76HD0aCV5QXErYQlTwnGYFkf7z7h X-Received: by 2002:a05:6e02:144c:: with SMTP id p12mr20399477ilo.292.1632188602891; Mon, 20 Sep 2021 18:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188602; cv=none; d=google.com; s=arc-20160816; b=WIhk2rELNY7/EuhgcPZkqpi8T75aKdF7e1rjXhvhuS6YwLR7p8TMgxPPrpDVhzOrQK +ybfHq6/Q/4p6w6AAbSoGqFt8i0Iwtr+tH3TlehRTdwCbzzLHRmCRtoiVJLtU5MWutc5 DF/0+dnPGcWqMGEKE97F2DDc9vh/aAMDv0Xz07M2XpADie1oHeRZVjMwos372a9cekq6 xYLko+KIT3ajUcgjsbQ/izBI+VxPQNDUEFa2uGA/aioIgKKVQh9P2rWYAaWt25E0RHho xrH6ehLuM2+c5X0IPlAN76XfsNSvY8gCfyRV3nrfawknJWyxtx/6v7yk9Rf+sMFHE34s zWEw== 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=VGBGwc1LKIFOq1xPw+oCXp3Hjz7qqMsYMVEOeP+onU8=; b=v6rp+D2PjaXBYPo0d+4liYwSRQCLtPr8KdzvAzG5K126C9BbVWxrmBAj2WnZ1zHFRB IGNeeI5kJa0Gupq9pYMRtPDySzUD6FwV8y+wNCpXMQMf75FvfyxdfAAMfwWHtU83slNQ 5K0Ve1tBMQ99JIgUh7mqO6R5loWjGNzptTGFDYdewgRv/+/I1HpspUkIWHI9h51ulvBE evusTja0AIKU1vIA47zZiLDrN9PfaLE0YKaiE7dGVL6AHq9GRlBzKFfsr3Nazor3IqqR KEdEj7TYTirimIztLazELsTdMNQqVqMh0DM8o1rufqSNQjymXilglc75ypf65q1ar2LZ ooeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JXUOvakt; 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 k26si7877722ioh.55.2021.09.20.18.43.11; Mon, 20 Sep 2021 18:43:22 -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=JXUOvakt; 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 S232994AbhITQ4v (ORCPT + 99 others); Mon, 20 Sep 2021 12:56:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:39558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245229AbhITQxi (ORCPT ); Mon, 20 Sep 2021 12:53:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8B9C6127A; Mon, 20 Sep 2021 16:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632156615; bh=zd0DkbpuQcpBmHy18xkWnu4PKH7ypTbTfRWtx7Uo9sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JXUOvaktPeO1Xfyn5n8gE7bpnfKjYlP3T+IFB1/MsujCQZzl/Dy1wE+IG1CpugqCV /PYvYzufY66O/MIL96/G7PHa6Q9FGAiQOY7pGRM9R/AeXz2Kgu5dxsh+uQ6FTfmZ/9 I5Y3Y9utASMZ9ZuyBo8PJXjW6IjJjy2bNOgVZuwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , "David S. Miller" , Sasha Levin Subject: [PATCH 4.4 133/133] net: renesas: sh_eth: Fix freeing wrong tx descriptor Date: Mon, 20 Sep 2021 18:43:31 +0200 Message-Id: <20210920163916.971064473@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163912.603434365@linuxfoundation.org> References: <20210920163912.603434365@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: Yoshihiro Shimoda [ Upstream commit 0341d5e3d1ee2a36dd5a49b5bef2ce4ad1cfa6b4 ] The cur_tx counter must be incremented after TACT bit of txdesc->status was set. However, a CPU is possible to reorder instructions and/or memory accesses between cur_tx and txdesc->status. And then, if TX interrupt happened at such a timing, the sh_eth_tx_free() may free the descriptor wrongly. So, add wmb() before cur_tx++. Otherwise NETDEV WATCHDOG timeout is possible to happen. Fixes: 86a74ff21a7a ("net: sh_eth: add support for Renesas SuperH Ethernet") Signed-off-by: Yoshihiro Shimoda Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/renesas/sh_eth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 1942264b621b..73fc8e9683b7 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -2426,6 +2426,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) else txdesc->status |= cpu_to_edmac(mdp, TD_TACT); + wmb(); /* cur_tx must be incremented after TACT bit was set */ mdp->cur_tx++; if (!(sh_eth_read(ndev, EDTRR) & sh_eth_get_edtrr_trns(mdp))) -- 2.30.2