From: Cyril Hrubis <chrubis@suse.cz>
To: Martin Doucha <mdoucha@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/3] tst_netdevice: Add missing rtnetlink context allocation checks
Date: Fri, 28 Jul 2023 09:46:51 +0200 [thread overview]
Message-ID: <ZMNya4WWC3IP6FZZ@yuki> (raw)
In-Reply-To: <20230727150013.31835-1-mdoucha@suse.cz>
Hi!
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
> lib/tst_netdevice.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/lib/tst_netdevice.c b/lib/tst_netdevice.c
> index 4a0442932..a57f506e9 100644
> --- a/lib/tst_netdevice.c
> +++ b/lib/tst_netdevice.c
> @@ -332,6 +332,9 @@ static int change_ns(const char *file, const int lineno, const char *ifname,
>
> ctx = create_request(file, lineno, RTM_NEWLINK, 0, &info, sizeof(info));
>
> + if (!ctx)
> + return 0;
> +
> if (!tst_rtnl_add_attr_string(file, lineno, ctx, IFLA_IFNAME, ifname)) {
> tst_rtnl_destroy_context(file, lineno, ctx);
> return 0;
> @@ -411,6 +414,9 @@ static int modify_route(const char *file, const int lineno, unsigned int action,
>
> ctx = create_request(file, lineno, action, flags, &info, sizeof(info));
>
> + if (!ctx)
> + return 0;
> +
> if (srcaddr && !tst_rtnl_add_attr(file, lineno, ctx, RTA_SRC, srcaddr,
> srclen)) {
> tst_rtnl_destroy_context(file, lineno, ctx);
Shouldn't we tst_brk_() in these cases? This function is a base for
NETDEV_CHANGE_NS_*() which is used as a safe macro without checking it's
return value.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-07-28 7:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 15:00 [LTP] [PATCH 1/3] tst_netdevice: Add missing rtnetlink context allocation checks Martin Doucha
2023-07-27 15:00 ` [LTP] [PATCH 2/3] tst_netdevice: Add helper functions for qdisc and filter management Martin Doucha
2023-07-28 7:53 ` Cyril Hrubis
2023-07-28 8:21 ` Martin Doucha
2023-07-28 12:09 ` Petr Vorel
2023-07-27 15:00 ` [LTP] [PATCH 3/3] Add test for CVE 2023-1829 Martin Doucha
2023-07-28 8:36 ` Petr Vorel
2023-08-03 12:51 ` Cyril Hrubis
2023-08-04 9:23 ` Martin Doucha
2023-07-28 7:46 ` Cyril Hrubis [this message]
2023-07-28 8:17 ` [LTP] [PATCH 1/3] tst_netdevice: Add missing rtnetlink context allocation checks Martin Doucha
2023-07-28 8:45 ` Cyril Hrubis
2023-07-28 11:43 ` Petr Vorel
2023-08-04 13:28 ` [LTP] [PATCH v2 3/3] Add test for CVE 2023-1829 Martin Doucha
2023-08-04 13:38 ` Cyril Hrubis
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=ZMNya4WWC3IP6FZZ@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=mdoucha@suse.cz \
/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.