From fb3c4efb65be520082a34c0afb85d492ff093c82 Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Thu, 27 May 2021 17:27:22 +0300 Subject: [PATCH] net/sfc: check ID overflow in action port ID The container in the action configuration is U32, but the ID is U16, and overflow check is missing. Fixes: 1fb65e4dae8a ("net/sfc: support flow action port ID in transfer rules") Cc: stable@dpdk.org Signed-off-by: Ivan Malov Reviewed-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_mae.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 33bff275cf..2ea2d63c5c 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -2653,6 +2653,9 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa, uint16_t port_id; int rc; + if (conf->id > UINT16_MAX) + return EOVERFLOW; + port_id = (conf->original != 0) ? sas->port_id : conf->id; rc = sfc_mae_switch_port_by_ethdev(mae->switch_domain_id, -- 2.20.1