]> git.baikalelectronics.ru Git - kernel.git/commit
be2net: Fix buffer overflow in be_get_module_eeprom
authorHristo Venev <hristo@venev.name>
Sat, 16 Jul 2022 08:51:34 +0000 (11:51 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 19 Jul 2022 09:51:16 +0000 (11:51 +0200)
commit17b866253dbac55cd25d45e6e939fd26a050ad15
treeaed68f298614c396a3a3212ab03e5ff805f4b876
parent9ad71e751fe2a94b6d02d6d0a45df2c3134f387c
be2net: Fix buffer overflow in be_get_module_eeprom

be_cmd_read_port_transceiver_data assumes that it is given a buffer that
is at least PAGE_DATA_LEN long, or twice that if the module supports SFF
8472. However, this is not always the case.

Fix this by passing the desired offset and length to
be_cmd_read_port_transceiver_data so that we only copy the bytes once.

Fixes: cd593eb83720 ("be2net: add ethtool "-m" option support")
Signed-off-by: Hristo Venev <hristo@venev.name>
Link: https://lore.kernel.org/r/20220716085134.6095-1-hristo@venev.name
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_cmds.h
drivers/net/ethernet/emulex/benet/be_ethtool.c