From: Florian Westphal <fw@strlen.de>
To: Anton Moryakov <ant.v.moryakov@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] src: fix deref of null.ret in rule.c
Date: Mon, 3 Mar 2025 02:45:27 +0100 [thread overview]
Message-ID: <20250303014527.GA18770@breakpoint.cc> (raw)
In-Reply-To: <20250302194435.666393-1-ant.v.moryakov@gmail.com>
Anton Moryakov <ant.v.moryakov@gmail.com> wrote:
> Fix potential null pointer dereference in `do_list_flowtable`.
>
> The pointer `table` is initialized to NULL and passed to `do_list_flowtable`,
> where it may be dereferenced. This can lead to a crash if `table` remains NULL.
>
> Changes:
> - Added a NULL check for the `table` pointer before calling `do_list_flowtable`.
> - Return an error code (-1) if `table` is NULL to handle the case where the table is not found.
This changelog doesn't match the patch.
> index f7582914..59d3f3ac 100644
> --- a/src/rule.c
> +++ b/src/rule.c
> @@ -1556,7 +1556,7 @@ static int do_delete_setelems(struct netlink_ctx *ctx, struct cmd *cmd)
> const struct set *set = cmd->elem.set;
> struct expr *expr = cmd->elem.expr;
>
> - if (set_is_non_concat_range(set) &&
> + if (set && set_is_non_concat_range(set) &&
> set_to_intervals(set, expr, false) < 0)
> return -1;
You need to explain how "set" can be NULL here.
This gets allocated in nft_cmd_expand, where set was
already dereferenced.
prev parent reply other threads:[~2025-03-03 1:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-02 19:44 [PATCH] src: fix deref of null.ret in rule.c Anton Moryakov
2025-03-03 1:45 ` Florian Westphal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250303014527.GA18770@breakpoint.cc \
--to=fw@strlen.de \
--cc=ant.v.moryakov@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.