linux/drivers/net/ethernet/hisilicon/hns3/hns3pf
Yunsheng Lin e8ccbb7d2f net: hns3: Fix for out-of-bounds access when setting pfc back pressure
The vport should be initialized to hdev->vport for each bp group,
otherwise it will cause out-of-bounds access and bp setting not
correct problem.

[   35.254124] BUG: KASAN: slab-out-of-bounds in hclge_pause_setup_hw+0x2a0/0x3f8 [hclge]
[   35.254126] Read of size 2 at addr ffff803b6651581a by task kworker/0:1/14

[   35.254132] CPU: 0 PID: 14 Comm: kworker/0:1 Not tainted 4.19.0-rc7-hulk+ #85
[   35.254133] Hardware name: Huawei D06/D06, BIOS Hisilicon D06 UEFI RC0 - B052 (V0.52) 09/14/2018
[   35.254141] Workqueue: events work_for_cpu_fn
[   35.254144] Call trace:
[   35.254147]  dump_backtrace+0x0/0x2f0
[   35.254149]  show_stack+0x24/0x30
[   35.254154]  dump_stack+0x110/0x184
[   35.254157]  print_address_description+0x168/0x2b0
[   35.254160]  kasan_report+0x184/0x310
[   35.254162]  __asan_load2+0x7c/0xa0
[   35.254170]  hclge_pause_setup_hw+0x2a0/0x3f8 [hclge]
[   35.254177]  hclge_tm_init_hw+0x794/0x9f0 [hclge]
[   35.254184]  hclge_tm_schd_init+0x48/0x58 [hclge]
[   35.254191]  hclge_init_ae_dev+0x778/0x1168 [hclge]
[   35.254196]  hnae3_register_ae_dev+0x14c/0x298 [hnae3]
[   35.254206]  hns3_probe+0x88/0xa8 [hns3]
[   35.254210]  local_pci_probe+0x7c/0xf0
[   35.254212]  work_for_cpu_fn+0x34/0x50
[   35.254214]  process_one_work+0x4d4/0xa38
[   35.254216]  worker_thread+0x55c/0x8d8
[   35.254219]  kthread+0x1b0/0x1b8
[   35.254222]  ret_from_fork+0x10/0x1c

[   35.254224] The buggy address belongs to the page:
[   35.254228] page:ffff7e00ed994400 count:1 mapcount:0 mapping:0000000000000000 index:0x0 compound_mapcount: 0
[   35.273835] flags: 0xfffff8000008000(head)
[   35.282007] raw: 0fffff8000008000 dead000000000100 dead000000000200 0000000000000000
[   35.282010] raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
[   35.282012] page dumped because: kasan: bad access detected

[   35.282014] Memory state around the buggy address:
[   35.282017]  ffff803b66515700: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
[   35.282019]  ffff803b66515780: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
[   35.282021] >ffff803b66515800: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
[   35.282022]                             ^
[   35.282024]  ffff803b66515880: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
[   35.282026]  ffff803b66515900: fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe fe
[   35.282028] ==================================================================
[   35.282029] Disabling lock debugging due to kernel taint
[   35.282747] hclge driver initialization finished.

Fixes: 67bf2541f4 ("net: hns3: Fixes the back pressure setting when sriov is enabled")
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-11-03 15:41:58 -07:00
..
hclge_cmd.c net: hns3: bugfix for is_valid_csq_clean_head() 2018-10-31 12:42:38 -07:00
hclge_cmd.h net: hns3: Add enable and process hw errors of TM scheduler 2018-10-22 19:31:14 -07:00
hclge_dcb.c net: hns3: Change return type of hclge_tm_schd_info_update() 2018-09-28 10:37:42 -07:00
hclge_dcb.h net: hns3: Add SPDX tags to HNS3 PF driver 2018-07-21 08:44:23 -07:00
hclge_err.c net: hns3: fix spelling mistake "intrerrupt" -> "interrupt" 2018-10-31 12:33:10 -07:00
hclge_err.h net: hns3: Add enable and process hw errors of TM scheduler 2018-10-22 19:31:14 -07:00
hclge_main.c net: hns3: bugfix for rtnl_lock's range in the hclge_reset() 2018-10-31 12:42:38 -07:00
hclge_main.h net: hns3: fix incorrect return value/type of some functions 2018-10-31 12:42:38 -07:00
hclge_mbx.c net: hns3: bugfix for handling mailbox while the command queue reinitialized 2018-10-31 12:42:38 -07:00
hclge_mdio.c net: hns3: bugfix for hclge_mdio_write and hclge_mdio_read 2018-10-31 12:42:38 -07:00
hclge_mdio.h net: hns3: Fix for information of phydev lost problem when down/up 2018-08-14 09:54:23 -07:00
hclge_tm.c net: hns3: Fix for out-of-bounds access when setting pfc back pressure 2018-11-03 15:41:58 -07:00
hclge_tm.h net: hns3: Change return type of hclge_tm_schd_info_update() 2018-09-28 10:37:42 -07:00
Makefile net: hns3: Add PCIe AER callback error_detected 2018-10-22 19:31:13 -07:00