netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Yuan Can <yuancan@huawei.com>,
	johannes@sipsolutions.net, davem@davemloft.net,
	yoshfuji@linux-ipv6.org, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH 1/2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write()
Date: Sun, 27 Nov 2022 12:39:03 -0700	[thread overview]
Message-ID: <d3eb1d37-fcbc-e3d7-30d4-3e97aa20696b@kernel.org> (raw)
In-Reply-To: <20221126100634.106887-2-yuancan@huawei.com>

On 11/26/22 3:06 AM, Yuan Can wrote:
> As the nla_nest_start() may fail with NULL returned, the return value needs
> to be checked.
> 
> Fixes: c7d759eb7b12 ("ethtool: add tunnel info interface")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
>  net/ipv4/udp_tunnel_nic.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c
> index bc3a043a5d5c..75a0caa4aebe 100644
> --- a/net/ipv4/udp_tunnel_nic.c
> +++ b/net/ipv4/udp_tunnel_nic.c
> @@ -624,6 +624,8 @@ __udp_tunnel_nic_dump_write(struct net_device *dev, unsigned int table,
>  			continue;
>  
>  		nest = nla_nest_start(skb, ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY);
> +		if (!nest)
> +			goto err_cancel;

no need to call nla_nest_cancel if nest_start fails.

>  
>  		if (nla_put_be16(skb, ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT,
>  				 utn->entries[table][j].port) ||


  reply	other threads:[~2022-11-27 19:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26 10:06 [PATCH 0/2] Add check for nla_nest_start() Yuan Can
2022-11-26 10:06 ` [PATCH 1/2] udp_tunnel: Add checks for nla_nest_start() in __udp_tunnel_nic_dump_write() Yuan Can
2022-11-27 19:39   ` David Ahern [this message]
2022-11-29  1:29     ` Yuan Can
2022-11-26 10:06 ` [PATCH 2/2] wifi: nl80211: Add checks for nla_nest_start() in nl80211_send_iface() Yuan Can
2022-11-28 22:18 ` [PATCH 0/2] Add check for nla_nest_start() Jakub Kicinski
2022-11-29  1:30   ` Yuan Can

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=d3eb1d37-fcbc-e3d7-30d4-3e97aa20696b@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yoshfuji@linux-ipv6.org \
    --cc=yuancan@huawei.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).