提交 b70b1677 编写于 作者: G Grant Grundler 提交者: Zheng Zengkai

net: atlantic: add check for MAX_SKB_FRAGS

stable inclusion
from stable-v5.10.118
commit cd66ab20a8f84474564a68fffffd37d998f6c340
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L686

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=cd66ab20a8f84474564a68fffffd37d998f6c340

--------------------------------

[ Upstream commit 6aecbba1 ]

Enforce that the CPU can not get stuck in an infinite loop.
Reported-by: NAashay Shringarpure <aashay@google.com>
Reported-by: NYi Chou <yich@google.com>
Reported-by: NShervin Oloumi <enlightened@google.com>
Signed-off-by: NGrant Grundler <grundler@chromium.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 727fb249
......@@ -362,6 +362,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
continue;
if (!buff->is_eop) {
unsigned int frag_cnt = 0U;
buff_ = buff;
do {
bool is_rsc_completed = true;
......@@ -370,6 +371,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
err = -EIO;
goto err_exit;
}
frag_cnt++;
next_ = buff_->next,
buff_ = &self->buff_ring[next_];
is_rsc_completed =
......@@ -377,7 +380,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
next_,
self->hw_head);
if (unlikely(!is_rsc_completed)) {
if (unlikely(!is_rsc_completed) ||
frag_cnt > MAX_SKB_FRAGS) {
err = 0;
goto err_exit;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册