]> 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:22:58 +0000 (11:22 +0100)
commite330d1b556f620269b3c4de7a0820974fec5e664
treeb609c73d85aa51d1215ff50b0ec53f29df1e35c3
parent61264cb3cb04b5a613c97d0cff717310b8e1a5b0
nfp: add port from netdev validation for EEPROM access

[ Upstream commit 0873016d46f6dfafd1bdf4d9b935b3331b226f7c ]

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: 04bc9617883c ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c