Commit 669a927e authored by Jaco Coetzee's avatar Jaco Coetzee Committed by sanglipeng
Browse files

nfp: add port from netdev validation for EEPROM access

stable inclusion
from stable-v5.10.157
commit 72be055615e0d8170ade2a0f750a7171b53fd37c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7MU59

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=72be055615e0d8170ade2a0f750a7171b53fd37c



--------------------------------

[ Upstream commit 0873016d ]

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: 4ae97cae ("nfp: ethtool: fix the display error of `ethtool -m DEVNAME`")
Signed-off-by: default avatarJaco Coetzee <jaco.coetzee@corigine.com>
Reviewed-by: default avatarLouis Peens <louis.peens@corigine.com>
Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 34173751
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment