Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3923750pxj; Mon, 21 Jun 2021 09:28:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykNafUguutl132pnLK0ecNoc1ZTMQr2/VZeUbhMZAtL4wlGyyB4vhQEfi+/WfTWoXv7T2M X-Received: by 2002:a05:6638:3807:: with SMTP id i7mr18508055jav.5.1624292898995; Mon, 21 Jun 2021 09:28:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292898; cv=none; d=google.com; s=arc-20160816; b=JaBSmqQRqK+pMnzrFJjvG36TkVB21PW8+eQmWDQR9/8WMyA9n2vQLu1fJzjVMDQ52Z mGVwYCJCCvS+m5Re+eTSYcxUURCOswpCFfZ0tKZqKSkhcMzDhk+K1Qp2YC0/Bq6XpuzD qWfu6piA4nGEpem9SrmjJX2PV+tyJhyV5fH0FTcd472CIRKjxahILNoiVPWeGhJJE25b vSPjcDE8LJKye1QRSE7+MhJRzm7v5717xtDtlUuFdGh2eP84L1fxm7dwlk8/TqhFwcN6 ZioGIXjuseHua46BNScFxHwItxSSdyzy5DF0K/i5EBHEKDtFNARoaCFBljJj9b8aRHdy WqOg== 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=Ueq5XmqXVH67I6UB6aVip6j9VV1+qMuDM2fRDQViP5SDuy6bJM3lid3c5mxzjttYq0 gn4+O1db/Gzx9oIEtjTz9xmnn/L48XOV8dHTtTZaEl7RG8aBDS9yoh9RAzVVl244rnSZ r+M8p+d8jSyeissaj78F4Inj8rvza9e6jZWhWc74FOlS1hMWQpIpWnKW+nVo7xzG8ANI b/sJa/Q7ca+Ky7ms2W6P/5p272nvzl6kjgBg0BI7Mx0JC/sklfOGQmqmR+XnYicWuHNB ZZp4M6QyAwCAq074bXjC1r87hjSnFu5653M/pKJGLYTaSKo5FRieskyebANBbNYANB2P 7bpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qh/kwLCR"; 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 t5si15617509ilu.154.2021.06.21.09.28.06; Mon, 21 Jun 2021 09:28:18 -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="Qh/kwLCR"; 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 S231986AbhFUQ3v (ORCPT + 99 others); Mon, 21 Jun 2021 12:29:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:48558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231892AbhFUQ2G (ORCPT ); Mon, 21 Jun 2021 12:28:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C467613B1; Mon, 21 Jun 2021 16:23:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292590; bh=Tyy6jEVdGZZjBAucuzuywBn8G+/KiDXxfkyZU26Lvvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qh/kwLCR4APhZrLjMmNCCVU9ZqSoUIg0TQSezO1MJSS2DJhwq7/kF0NJVtiJh5/Oy 1APDyLy1JqeevFl0stK0bQIMTxWbMa4blrhNXhC3Uh+42j7TmUWtnHtTXr13o6RS51 A9WMBE9sbHSD0Rw0waz6zCxCwTjfYlKX4VMNMxI4= 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.10 057/146] lantiq: net: fix duplicated skb in rx descriptor ring Date: Mon, 21 Jun 2021 18:14:47 +0200 Message-Id: <20210621154914.175949075@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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