From: Roi Dayan <roid@nvidia.com>
To: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>,
<netdev@vger.kernel.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Alexander Mikhalitsyn <alexander@mihalicyn.com>
Subject: Re: [PATCH iproute2] libnetlink: check error handler is present before a call
Date: Sun, 11 Jul 2021 14:18:30 +0300 [thread overview]
Message-ID: <54821a00-0dd1-da72-0445-63af284eb8b3@nvidia.com> (raw)
In-Reply-To: <20210711111546.3695-1-alexander.mikhalitsyn@virtuozzo.com>
On 2021-07-11 2:15 PM, Alexander Mikhalitsyn wrote:
> Fix nullptr dereference of errhndlr from rtnl_dump_filter_arg
> struct in rtnl_dump_done and rtnl_dump_error functions.
>
> Fixes: 459ce6e3d792 ("ip route: ignore ENOENT during save if RT_TABLE_MAIN is being dumped")
> Cc: Stephen Hemminger <stephen@networkplumber.org>
> Cc: Roi Dayan <roid@nvidia.com>
> Cc: Alexander Mikhalitsyn <alexander@mihalicyn.com>
> Reported-by: Roi Dayan <roid@nvidia.com>
> Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn@virtuozzo.com>
> ---
> lib/libnetlink.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/libnetlink.c b/lib/libnetlink.c
> index e9b8c3bd..d068dbe2 100644
> --- a/lib/libnetlink.c
> +++ b/lib/libnetlink.c
> @@ -686,7 +686,7 @@ static int rtnl_dump_done(struct nlmsghdr *h,
> if (len < 0) {
> errno = -len;
>
> - if (a->errhndlr(h, a->arg2) & RTNL_SUPPRESS_NLMSG_DONE_NLERR)
> + if (a->errhndlr && (a->errhndlr(h, a->arg2) & RTNL_SUPPRESS_NLMSG_DONE_NLERR))
> return 0;
>
> /* check for any messages returned from kernel */
> @@ -729,7 +729,7 @@ static int rtnl_dump_error(const struct rtnl_handle *rth,
> errno == EOPNOTSUPP))
> return -1;
>
> - if (a->errhndlr(h, a->arg2) & RTNL_SUPPRESS_NLMSG_ERROR_NLERR)
> + if (a->errhndlr && (a->errhndlr(h, a->arg2) & RTNL_SUPPRESS_NLMSG_ERROR_NLERR))
> return 0;
>
> if (!(rth->flags & RTNL_HANDLE_F_SUPPRESS_NLERR))
>
that was quick. was about to send the exact same patch :)
so tested as well. thanks!
Reviewed-by: Roi Dayan <roid@nvidia.com>
next prev parent reply other threads:[~2021-07-11 11:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-11 11:15 [PATCH iproute2] libnetlink: check error handler is present before a call Alexander Mikhalitsyn
2021-07-11 11:18 ` Roi Dayan [this message]
2021-07-11 11:26 ` Alexander Mihalicyn
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=54821a00-0dd1-da72-0445-63af284eb8b3@nvidia.com \
--to=roid@nvidia.com \
--cc=alexander.mikhalitsyn@virtuozzo.com \
--cc=alexander@mihalicyn.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox