]> git.itanic.dy.fi Git - linux-stable/commit
net: hns3: fix reuse conflict of the rx page
authorYunsheng Lin <linyunsheng@huawei.com>
Fri, 18 Jun 2021 12:09:45 +0000 (20:09 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jun 2021 19:26:17 +0000 (12:26 -0700)
commit961045004b774aae7a244fa0435f8a6a2495c234
treede389328d3a40af609737b41b93ca0c647c30e5c
parentcb5a82d2b9aaca66ed74c424c9d79f0a5bfdbac4
net: hns3: fix reuse conflict of the rx page

In the current rx page reuse handling process, the rx page buffer may
have conflict between driver and stack in high-pressure scenario.

To fix this problem, we need to check whether the page is only owned
by driver at the begin and at the end of a page to make sure there is
no reuse conflict between driver and stack when desc_cb->page_offset
is rollbacked to zero or increased.

Fixes: fa7711b888f2 ("net: hns3: optimize the rx page reuse handling process")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c