[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220705185238.1c287512@kernel.org>
Date: Tue, 5 Jul 2022 18:52:38 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Hoang Le <hoang.h.le@...tech.com.au>
Cc: jmaloy@...hat.com, maloy@...jonn.com, ying.xue@...driver.com,
tung.q.nguyen@...tech.com.au, pabeni@...hat.com,
edumazet@...gle.com, tipc-discussion@...ts.sourceforge.net,
netdev@...r.kernel.org, davem@...emloft.net,
syzbot+a73d24a22eeeebe5f244@...kaller.appspotmail.com
Subject: Re: [net-next] tipc: fix uninit-value in
tipc_nl_node_reset_link_stats
On Tue, 5 Jul 2022 07:50:57 +0700 Hoang Le wrote:
> Reported-by: syzbot+a73d24a22eeeebe5f244@...kaller.appspotmail.com
> Acked-by: Jon Maloy <jmaloy@...hat.com>
> Signed-off-by: Hoang Le <hoang.h.le@...tech.com.au>
Can we get a Fixes tag please?
> diff --git a/net/tipc/node.c b/net/tipc/node.c
> index b48d97cbbe29..23419a599471 100644
> --- a/net/tipc/node.c
> +++ b/net/tipc/node.c
> @@ -2561,6 +2561,7 @@ int tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info)
> struct net *net = sock_net(skb->sk);
> struct tipc_net *tn = tipc_net(net);
> struct tipc_link_entry *le;
> + int len;
>
> if (!info->attrs[TIPC_NLA_LINK])
> return -EINVAL;
> @@ -2574,7 +2575,14 @@ int tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info)
> if (!attrs[TIPC_NLA_LINK_NAME])
> return -EINVAL;
>
> + len = nla_len(attrs[TIPC_NLA_LINK_NAME]);
> + if (len <= 0)
> + return -EINVAL;
> +
> link_name = nla_data(attrs[TIPC_NLA_LINK_NAME]);
> + len = min_t(int, len, TIPC_MAX_LINK_NAME);
> + if (!memchr(link_name, '\0', len))
> + return -EINVAL;
Should we just change the netlink policy for this attribute to
NLA_NUL_STRING, then?
Powered by blists - more mailing lists