From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr710099.outbound.protection.outlook.com ([40.107.71.99]:10496 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387611AbeITIa0 (ORCPT ); Thu, 20 Sep 2018 04:30:26 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Huazhong Tan , Salil Mehta , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.9 05/14] net: hns: fix skb->truesize underestimation Date: Thu, 20 Sep 2018 02:48:45 +0000 Message-ID: <20180920024838.58666-5-alexander.levin@microsoft.com> References: <20180920024838.58666-1-alexander.levin@microsoft.com> In-Reply-To: <20180920024838.58666-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Huazhong Tan [ 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 usa= ge") Signed-off-by: Huazhong tan Signed-off-by: Salil Mehta Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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/et= hernet/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, } =20 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); =20 /* avoid re-using remote pages,flag default unreuse */ if (unlikely(page_to_nid(desc_cb->priv) !=3D numa_node_id())) --=20 2.17.1