linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "stable@vger.kernel.org" <stable@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Huazhong Tan <tanhuazhong@huawei.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL 4.9 05/14] net: hns: fix skb->truesize underestimation
Date: Thu, 20 Sep 2018 02:48:45 +0000	[thread overview]
Message-ID: <20180920024838.58666-5-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20180920024838.58666-1-alexander.levin@microsoft.com>

From: Huazhong Tan <tanhuazhong@huawei.com>

[ Upstream commit b1ccd4c0ab6ef499f47dd84ed4920502a7147bba ]

skb->truesize is not meant to be tracking amount of used bytes in a skb,
but amount of reserved/consumed bytes in memory.

For instance, if we use a single byte in last page fragment, we have to
account the full size of the fragment.

So skb_add_rx_frag needs to calculate the length of the entire buffer into
turesize.

Fixes: 9cbe9fd5214e ("net: hns: optimize XGE capability by reducing cpu usage")
Signed-off-by: Huazhong tan <tanhuazhong@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
 drivers/net/ethernet/hisilicon/hns/hns_enet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 111e1aab7d83..8a2a07e21324 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -529,7 +529,7 @@ static void hns_nic_reuse_page(struct sk_buff *skb, int i,
 	}
 
 	skb_add_rx_frag(skb, i, desc_cb->priv, desc_cb->page_offset + pull_len,
-			size - pull_len, truesize - pull_len);
+			size - pull_len, truesize);
 
 	 /* avoid re-using remote pages,flag default unreuse */
 	if (unlikely(page_to_nid(desc_cb->priv) != numa_node_id()))
-- 
2.17.1

  parent reply	other threads:[~2018-09-20  2:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20  2:48 [PATCH AUTOSEL 4.9 01/14] qed: Wait for ready indication before rereading the shmem Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 02/14] qed: Wait for MCP halt and resume commands to take place Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 04/14] net: hns: fix length and page_offset overflow when CONFIG_ARM64_64K_PAGES Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 03/14] thermal: of-thermal: disable passive polling when thermal zone is disabled Sasha Levin
2018-09-20  2:48 ` Sasha Levin [this message]
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 06/14] e1000: check on netif_running() before calling e1000_up() Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 07/14] e1000: ensure to free old tx/rx rings in set_ringparam() Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 08/14] hwmon: (ina2xx) fix sysfs shunt resistor read access Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 09/14] hwmon: (adt7475) Make adt7475_read_word() return errors Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 10/14] drm/amdgpu: Enable/disable gfx PG feature in rlc safe mode Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 12/14] arm/arm64: smccc-1.1: Make return values unsigned long Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 11/14] drm/amdgpu: Update power state at the end of smu hw_init Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 13/14] arm/arm64: smccc-1.1: Handle function result as parameters Sasha Levin
2018-09-20  2:48 ` [PATCH AUTOSEL 4.9 14/14] i2c: i801: Allow ACPI AML access I/O ports not reserved for SMBus Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180920024838.58666-5-alexander.levin@microsoft.com \
    --to=alexander.levin@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=tanhuazhong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).