summaryrefslogtreecommitdiff
path: root/zebra/zebra_mpls.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-08-04 13:38:25 -0400
committerDonald Sharp <sharpd@nvidia.com>2021-08-04 13:38:25 -0400
commit6140b3b41b37fcd0fac23ed11f9fa9df1db36b3c (patch)
tree8a98ba27abc238b3e34137c52c82580d7d3168fc /zebra/zebra_mpls.c
parentb7457b40cd77e0f3e6b45a77232af64aba17aea3 (diff)
zebra: prevent crash when nhlfe is NULL
There exists a call path where the nhlfe_alloc can return NULL for blackhole nexthops. In this case we were still trying to save the nhlfe pointer causing a crash when we attempted to add it to a self-contained list. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra/zebra_mpls.c')
-rw-r--r--zebra/zebra_mpls.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c
index f1a7c3e8c1..2f83fe4e28 100644
--- a/zebra/zebra_mpls.c
+++ b/zebra/zebra_mpls.c
@@ -1323,6 +1323,9 @@ static zebra_nhlfe_t *nhlfe_add(zebra_lsp_t *lsp, enum lsp_types_t lsp_type,
nhlfe = nhlfe_alloc(lsp, lsp_type, gtype, gate, ifindex, num_labels,
labels);
+ if (!nhlfe)
+ return NULL;
+
/* Enqueue to LSP: primaries at head of list, backups at tail */
if (is_backup) {
SET_FLAG(nhlfe->flags, NHLFE_FLAG_IS_BACKUP);