libnl3/backport-fix-leak-in-error-handling-of-rtnl_flower_append_action.patch

46 lines
1.2 KiB
Diff
Raw Permalink Normal View History

From 7912b4f90668afab9b7cb7054434d341826b8c54 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 1 Dec 2023 19:51:41 +0100
Subject: [PATCH] route/cls: fix leak in error handling of
rtnl_flower_append_action()
Using rtnl_act_append() correctly is hard.
Fixes: ef46de143206 ('route/cls: add flower classifier')
Conflict:NA
Reference:https://github.com/thom311/libnl/commit/7912b4f90668afab9b7cb7054434d341826b8c54
---
lib/route/cls/flower.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/route/cls/flower.c b/lib/route/cls/flower.c
index 11bd709..65f0ccf 100644
--- a/lib/route/cls/flower.c
+++ b/lib/route/cls/flower.c
@@ -787,6 +787,7 @@ int rtnl_flower_get_ipv4_dst(struct rtnl_cls *cls, in_addr_t *out_addr,
int rtnl_flower_append_action(struct rtnl_cls *cls, struct rtnl_act *act)
{
struct rtnl_flower *f;
+ int err;
if (!act)
return 0;
@@ -796,8 +797,11 @@ int rtnl_flower_append_action(struct rtnl_cls *cls, struct rtnl_act *act)
f->cf_mask |= FLOWER_ATTR_ACTION;
+ if ((err = rtnl_act_append(&f->cf_act, act)) < 0)
+ return err;
+
rtnl_act_get(act);
- return rtnl_act_append(&f->cf_act, act);
+ return 0;
}
/**
--
2.33.0