From: Viacheslav Ovsiienko Date: Sat, 10 Nov 2018 09:59:25 +0000 (+0000) Subject: net/mlx5: fix buffer allocation check in rule cleanup X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=00ae11c4e876e05988c7ed87bfb12d7113bb7900;p=dpdk.git net/mlx5: fix buffer allocation check in rule cleanup The Netlink message buffer is allocated and there is the typo, the other pointer is checked instead of returned one. If no memory is allocated and NULL is returned by allocation routine the bug causes segmentation fault. The patch fixes typo, returned pointer is validated. Fixes: f420f03d6772 ("net/mlx5: add E-switch VXLAN rule cleanup routines") Signed-off-by: Viacheslav Ovsiienko Acked-by: Shahaf Shuler Acked-by: Yongseok Koh --- diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index fb817b2311..ba0674a87c 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -4226,7 +4226,7 @@ flow_tcf_collect_vxlan_cb(const struct nlmsghdr *nlh, void *arg) vxindex = ifm->ifi_index; cmd = flow_tcf_alloc_nlcmd(ctx, MNL_ALIGN(sizeof(struct nlmsghdr)) + MNL_ALIGN(sizeof(struct ifinfomsg))); - if (!nlh) { + if (!cmd) { rte_errno = ENOMEM; return -rte_errno; }