Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3936775pxj; Mon, 21 Jun 2021 09:44:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycDP1PsmcVb0NzhxRllUuXvlmC1HCyoB3q1Ok6MOeRcK7X9421dsDfNijCgpS+2kyWrpCm X-Received: by 2002:a5d:85c1:: with SMTP id e1mr20274625ios.18.1624293892728; Mon, 21 Jun 2021 09:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293892; cv=none; d=google.com; s=arc-20160816; b=NKae/zrBvXnjfl290A34uYtzwaXCr+pwsXuTyNLJWeLNz3K9h/8imNHw5KBs+atowm /ayYiQxpvPaLdRUhbUsnUUueIC9fLXgZqmlh0t9hyjTFIkLezlSh8ZqJsVIETVFAR57o ObREuGTkg20RhhKVbMLmZRtK3tD81tnUPt5oKv3bG3soiYG14lHQDdwTQVyUebk2SecK sRNPCl+LUasIqSgeWCSYa+ElsbUE75f3lJgUUuBR1gq8yhSHXOx/Hk5JXZlbgB2Y71Vb PFedipoa1YA44ML6rM7FMbonqWRmbVRt3tTl6uzZSThVCa09voO/xdGAK0/3iJrrluIv TFiA== 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=K6iUikgXfWjgx0Q5GkBqKnlat7HKfF6kdYUwiPCp0oU=; b=HdPP2ADBcsUNrD4mbmO67Yxl1MaTpga27OoD/sR83iJf+IqEZZ+j6MaKTGxAGmHzt4 XrHf6OS7ADJ8GVTaDkkMVkOiqA4glcJthr1hvH8MeusnMajdocQ9oQ15HEoJWt48q+fM E/gXeJt252luEQwa43Y3PS6K1XhFR8PNsLjvf1h3aZLoDlAGHLMRvvybNHsbtR+F8kBW EySE/DBNKNaj/9+sv8OkggtvTF2ah6F+mM+zD6ykQnbs30gWucF2BVnddh5QFl7tOHHf Akb87MfdVsTGTNvQ/QOQ1nggLB8UwcEgmW5km88WFwhi3FwSHmRWGNw1psH5xnVyAblJ vXNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oomf3nJ6; 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 h2si2209096ilh.91.2021.06.21.09.44.39; Mon, 21 Jun 2021 09:44:52 -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=oomf3nJ6; 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 S231978AbhFUQn3 (ORCPT + 99 others); Mon, 21 Jun 2021 12:43:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:33338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbhFUQjw (ORCPT ); Mon, 21 Jun 2021 12:39:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7AD0961206; Mon, 21 Jun 2021 16:30:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293011; bh=Tyy6jEVdGZZjBAucuzuywBn8G+/KiDXxfkyZU26Lvvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oomf3nJ6xxEHSmO8pa89fI3y5PyrYrik0UVkBjQZlZIbXLZUcLbIFyt++qOBUnpwh V+Yk4Tynk0f6fO9Vpdgu95eRCvG6K38eccSqROoL8hJIxpIT7/AlBZY9L/f2el//RR K+iMfZYo4KSYjwNnlD0Zg0EZaJ9VIPk+fNz+beRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aleksander Jan Bajkowski , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 066/178] lantiq: net: fix duplicated skb in rx descriptor ring Date: Mon, 21 Jun 2021 18:14:40 +0200 Message-Id: <20210621154924.755623998@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@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: Aleksander Jan Bajkowski [ Upstream commit 7ea6cd16f1599c1eac6018751eadbc5fc736b99a ] The previous commit didn't fix the bug properly. By mistake, it replaces the pointer of the next skb in the descriptor ring instead of the current one. As a result, the two descriptors are assigned the same SKB. The error is seen during the iperf test when skb_put tries to insert a second packet and exceeds the available buffer. Fixes: c7718ee96dbc ("net: lantiq: fix memory corruption in RX ring ") Signed-off-by: Aleksander Jan Bajkowski Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/lantiq_xrx200.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c index 3da494df72f3..072075bc60ee 100644 --- a/drivers/net/ethernet/lantiq_xrx200.c +++ b/drivers/net/ethernet/lantiq_xrx200.c @@ -154,6 +154,7 @@ static int xrx200_close(struct net_device *net_dev) static int xrx200_alloc_skb(struct xrx200_chan *ch) { + struct sk_buff *skb = ch->skb[ch->dma.desc]; dma_addr_t mapping; int ret = 0; @@ -168,6 +169,7 @@ static int xrx200_alloc_skb(struct xrx200_chan *ch) XRX200_DMA_DATA_LEN, DMA_FROM_DEVICE); if (unlikely(dma_mapping_error(ch->priv->dev, mapping))) { dev_kfree_skb_any(ch->skb[ch->dma.desc]); + ch->skb[ch->dma.desc] = skb; ret = -ENOMEM; goto skip; } @@ -198,7 +200,6 @@ static int xrx200_hw_receive(struct xrx200_chan *ch) ch->dma.desc %= LTQ_DESC_NUM; if (ret) { - ch->skb[ch->dma.desc] = skb; net_dev->stats.rx_dropped++; netdev_err(net_dev, "failed to allocate new rx buffer\n"); return ret; -- 2.30.2