mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 09:20:25 +00:00
zebra: dplane_gre_set could return while leaking ctx
Prevent this function from leaking the ctx memory. Also properly record that something has gone wrong. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
6636fc44c8
commit
3e7b3ed1dc
@ -5303,8 +5303,10 @@ dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
|
|||||||
|
|
||||||
ctx = dplane_ctx_alloc();
|
ctx = dplane_ctx_alloc();
|
||||||
|
|
||||||
if (!ifp)
|
if (!ifp) {
|
||||||
return result;
|
ret = EINVAL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) {
|
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL) {
|
||||||
zlog_debug("init dplane ctx %s: if %s link %s%s",
|
zlog_debug("init dplane ctx %s: if %s link %s%s",
|
||||||
@ -5316,8 +5318,11 @@ dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
|
|||||||
ctx->zd_op = op;
|
ctx->zd_op = op;
|
||||||
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
|
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
|
||||||
zns = zebra_ns_lookup(ifp->vrf->vrf_id);
|
zns = zebra_ns_lookup(ifp->vrf->vrf_id);
|
||||||
if (!zns)
|
if (!zns) {
|
||||||
return result;
|
ret = EINVAL;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
dplane_ctx_ns_init(ctx, zns, false);
|
dplane_ctx_ns_init(ctx, zns, false);
|
||||||
|
|
||||||
dplane_ctx_set_ifname(ctx, ifp->name);
|
dplane_ctx_set_ifname(ctx, ifp->name);
|
||||||
@ -5336,6 +5341,7 @@ dplane_gre_set(struct interface *ifp, struct interface *ifp_link,
|
|||||||
/* Enqueue context for processing */
|
/* Enqueue context for processing */
|
||||||
ret = dplane_update_enqueue(ctx);
|
ret = dplane_update_enqueue(ctx);
|
||||||
|
|
||||||
|
done:
|
||||||
/* Update counter */
|
/* Update counter */
|
||||||
atomic_fetch_add_explicit(&zdplane_info.dg_gre_set_in, 1,
|
atomic_fetch_add_explicit(&zdplane_info.dg_gre_set_in, 1,
|
||||||
memory_order_relaxed);
|
memory_order_relaxed);
|
||||||
|
Loading…
Reference in New Issue
Block a user