netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Hoang Le <hoang.h.le@dektech.com.au>
Cc: jmaloy@redhat.com, maloy@donjonn.com, ying.xue@windriver.com,
	tung.q.nguyen@dektech.com.au, pabeni@redhat.com,
	edumazet@google.com, tipc-discussion@lists.sourceforge.net,
	netdev@vger.kernel.org, davem@davemloft.net,
	syzbot+a73d24a22eeeebe5f244@syzkaller.appspotmail.com
Subject: Re: [net-next] tipc: fix uninit-value in tipc_nl_node_reset_link_stats
Date: Tue, 5 Jul 2022 18:52:38 -0700	[thread overview]
Message-ID: <20220705185238.1c287512@kernel.org> (raw)
In-Reply-To: <20220705005058.3971-1-hoang.h.le@dektech.com.au>

On Tue,  5 Jul 2022 07:50:57 +0700 Hoang Le wrote:
> Reported-by: syzbot+a73d24a22eeeebe5f244@syzkaller.appspotmail.com
> Acked-by: Jon Maloy <jmaloy@redhat.com>
> Signed-off-by: Hoang Le <hoang.h.le@dektech.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?

  reply	other threads:[~2022-07-06  1:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05  0:50 [net-next] tipc: fix uninit-value in tipc_nl_node_reset_link_stats Hoang Le
2022-07-06  1:52 ` Jakub Kicinski [this message]
2022-07-06  3:36   ` Hoang Huu Le

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=20220705185238.1c287512@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hoang.h.le@dektech.com.au \
    --cc=jmaloy@redhat.com \
    --cc=maloy@donjonn.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+a73d24a22eeeebe5f244@syzkaller.appspotmail.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    --cc=tung.q.nguyen@dektech.com.au \
    --cc=ying.xue@windriver.com \
    /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;
as well as URLs for NNTP newsgroup(s).