From: Peng Zhang <[email protected]>
The original logic can not make sure the 'repr' pointer has
valid value and the dereference of null pointer will cause
a segment fault problem.
Fixes: eae7dadbe987 ("net/nfp: update link status reporting")
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Peng Zhang <[email protected]>
Reviewed-by: Chaoyong He <[email protected]>
Reviewed-by: Long Wu <[email protected]>
---
drivers/net/nfp/flower/nfp_flower_ctrl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c
b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index de6e419cac..8cfafe91c8 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -441,6 +441,11 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_app_fw_flower
*app_fw_flower,
return -EINVAL;
}
+ if (repr == NULL) {
+ PMD_DRV_LOG(ERR, "Can not get 'repr' for port %#x", port);
+ return -EINVAL;
+ }
+
repr->link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
if ((msg->info & NFP_FLOWER_CMSG_PORT_MOD_INFO_LINK) != 0)
repr->link.link_status = RTE_ETH_LINK_UP;
--
2.39.1