* [nft PATCH] src: netlink: netlink_delinearize_table() may return NULL
@ 2025-08-08 12:45 Phil Sutter
2025-08-13 15:35 ` Phil Sutter
0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2025-08-08 12:45 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
Catch the error condition in callers to avoid crashes.
Fixes: c156232a530b3 ("src: add comment support when adding tables")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
src/monitor.c | 4 ++++
src/netlink.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/monitor.c b/src/monitor.c
index e0f97b4a204dd..da1ad880f0c83 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -237,6 +237,10 @@ static int netlink_events_table_cb(const struct nlmsghdr *nlh, int type,
nlt = netlink_table_alloc(nlh);
t = netlink_delinearize_table(monh->ctx, nlt);
+ if (!t) {
+ nftnl_table_free(nlt);
+ return MNL_CB_ERROR;
+ }
cmd = netlink_msg2cmd(type, nlh->nlmsg_flags);
switch (monh->format) {
diff --git a/src/netlink.c b/src/netlink.c
index f2f4c5ea8c87b..94cbcbfc6c094 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -841,7 +841,8 @@ static int list_table_cb(struct nftnl_table *nlt, void *arg)
struct table *table;
table = netlink_delinearize_table(ctx, nlt);
- list_add_tail(&table->list, &ctx->list);
+ if (table)
+ list_add_tail(&table->list, &ctx->list);
return 0;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [nft PATCH] src: netlink: netlink_delinearize_table() may return NULL
2025-08-08 12:45 [nft PATCH] src: netlink: netlink_delinearize_table() may return NULL Phil Sutter
@ 2025-08-13 15:35 ` Phil Sutter
0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2025-08-13 15:35 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On Fri, Aug 08, 2025 at 02:45:36PM +0200, Phil Sutter wrote:
> Catch the error condition in callers to avoid crashes.
>
> Fixes: c156232a530b3 ("src: add comment support when adding tables")
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Patch applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-13 15:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 12:45 [nft PATCH] src: netlink: netlink_delinearize_table() may return NULL Phil Sutter
2025-08-13 15:35 ` Phil Sutter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.