]> git.baikalelectronics.ru Git - kernel.git/commit
nfp: add port from netdev validation for EEPROM access
authorJaco Coetzee <jaco.coetzee@corigine.com>
Thu, 17 Nov 2022 15:37:44 +0000 (16:37 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 19 Nov 2022 03:41:21 +0000 (19:41 -0800)
commit5d47f54ba55394dfdb6ce877811e0a18d7a0dfc2
tree28f1e2719d49fc612f66bfdd037d7e3bef4681ea
parent0cbb61dfcfa176d82059cea7d062874c52c24877
nfp: add port from netdev validation for EEPROM access

Setting of the port flag `NFP_PORT_CHANGED`, introduced
to ensure the correct reading of EEPROM data, causes a
fatal kernel NULL pointer dereference in cases where
the target netdev type cannot be determined.

Add validation of port struct pointer before attempting
to set the `NFP_PORT_CHANGED` flag. Return that operation
is not supported if the netdev type cannot be determined.

Fixes: 57b063516ab7 ("nfp: ethtool: fix the display error of `ethtool -m DEVNAME`")
Signed-off-by: Jaco Coetzee <jaco.coetzee@corigine.com>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c