]> git.baikalelectronics.ru Git - kernel.git/commit
hinic: fix bug of wq out of bound access
authorQiao Ma <mqaio@linux.alibaba.com>
Thu, 28 Apr 2022 12:30:16 +0000 (20:30 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 30 Apr 2022 01:37:45 +0000 (18:37 -0700)
commite92206585fb22bd0d519c8008602f25caab14590
treea37f93ccb517d4da67f9b1c42bc635c5ced34617
parent5c7145e1b32b2ce3af162c117b321a5d5bdcfc1d
hinic: fix bug of wq out of bound access

If wq has only one page, we need to check wqe rolling over page by
compare end_idx and curr_idx, and then copy wqe to shadow wqe to
avoid out of bound access.
This work has been done in hinic_get_wqe, but missed for hinic_read_wqe.
This patch fixes it, and removes unnecessary MASKED_WQE_IDX().

Fixes: 4c5b2b71b830 ("hinic: add sriov feature support")
Signed-off-by: Qiao Ma <mqaio@linux.alibaba.com>
Reviewed-by: Xunlei Pang <xlpang@linux.alibaba.com>
Link: https://lore.kernel.org/r/282817b0e1ae2e28fdf3ed8271a04e77f57bf42e.1651148587.git.mqaio@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c