net: hns3: fix desc filling bug when skb is expanded or lineared
authorYunsheng Lin <linyunsheng@huawei.com>
Tue, 28 Jul 2020 02:16:48 +0000 (10:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Aug 2020 07:58:41 +0000 (09:58 +0200)
commitb404147128db4cbebe81524ceb8e13ed7c120f32
tree646c5cbe5ff175d4c5c1c51148e1dc1bdc392a2e
parent2b26ef58b3400b4a9b9b9919d94afec8751a874b
net: hns3: fix desc filling bug when skb is expanded or lineared

[ Upstream commit cfdaeba5ddc98b303639a3265c2031ac5db249d6 ]

The linear and frag data part may be changed when the skb is expanded
or lineared in skb_cow_head() or skb_checksum_help(), which is called
by hns3_fill_skb_desc(), so the linear len return by skb_headlen()
before the calling of hns3_fill_skb_desc() is unreliable.

Move hns3_fill_skb_desc() before the calling of skb_headlen() to fix
this bug.

Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c