linux-stable/drivers/net/ethernet/hisilicon/hns
Teng Qi a66998e0fb ethernet: hisilicon: hns: hns_dsaf_misc: fix a possible array overflow in hns_dsaf_ge_srst_by_port()
The if statement:
  if (port >= DSAF_GE_NUM)
        return;

limits the value of port less than DSAF_GE_NUM (i.e., 8).
However, if the value of port is 6 or 7, an array overflow could occur:
  port_rst_off = dsaf_dev->mac_cb[port]->port_rst_off;

because the length of dsaf_dev->mac_cb is DSAF_MAX_PORT_NUM (i.e., 6).

To fix this possible array overflow, we first check port and if it is
greater than or equal to DSAF_MAX_PORT_NUM, the function returns.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Teng Qi <starmiku1207184332@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-11-18 11:15:47 +00:00
..
hnae.c drivers/net/ethernet: clean up mis-targeted comments 2020-09-25 16:29:00 -07:00
hnae.h ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
hns_ae_adapt.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
hns_dsaf_gmac.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
hns_dsaf_gmac.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hns_dsaf_mac.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
hns_dsaf_mac.h ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
hns_dsaf_main.c net: hisilicon: hns: Fix wrong function name in comments 2021-05-17 14:12:39 -07:00
hns_dsaf_main.h net: hns: Prefer struct_size over open coded arithmetic 2021-10-12 11:23:11 +01:00
hns_dsaf_misc.c ethernet: hisilicon: hns: hns_dsaf_misc: fix a possible array overflow in hns_dsaf_ge_srst_by_port() 2021-11-18 11:15:47 +00:00
hns_dsaf_misc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hns_dsaf_ppe.c net: hisilicon: hns: Fix wrong function name in comments 2021-05-17 14:12:39 -07:00
hns_dsaf_ppe.h net: hns: Replace zero-length array with flexible-array member 2020-02-26 16:43:09 -08:00
hns_dsaf_rcb.c net: hisilicon: hns: Fix wrong function name in comments 2021-05-17 14:12:39 -07:00
hns_dsaf_rcb.h net: hns: Replace zero-length array with flexible-array member 2020-02-26 16:43:09 -08:00
hns_dsaf_reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hns_dsaf_xgmac.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
hns_dsaf_xgmac.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hns_enet.c ethernet: use device_get_ethdev_address() 2021-10-07 13:39:51 +01:00
hns_enet.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hns_ethtool.c ethtool: extend coalesce setting uAPI with CQE mode 2021-08-24 07:38:29 -07:00
Makefile