net: atlantic: fix "frag[0] not initialized"
stable inclusion from stable-v5.10.118 commit 9b84e83a92cdacd1a768c4de04ec3d9a81b26c12 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=9b84e83a92cdacd1a768c4de04ec3d9a81b26c12 -------------------------------- [ Upstream commit 62e0ae0f ] In aq_ring_rx_clean(), if buff->is_eop is not set AND buff->len < AQ_CFG_RX_HDR_SIZE, then hdr_len remains equal to buff->len and skb_add_rx_frag(xxx, *0*, ...) is not called. The loop following this code starts calling skb_add_rx_frag() starting with i=1 and thus frag[0] is never initialized. Since i is initialized to zero at the top of the primary loop, we can just reference and post-increment i instead of hardcoding the 0 when calling skb_add_rx_frag() the first time. 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>
Showing
想要评论请 注册 或 登录