Netdev List
 help / color / mirror / Atom feed
From: Gregory Rose <gvrose8192@gmail.com>
To: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>,
	Pravin B Shelar <pshelar@ovn.org>,
	"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] openvswitch: Fix a possible memory leak on dst_cache
Date: Thu, 18 Jul 2019 15:12:43 -0700	[thread overview]
Message-ID: <9b231232-dd6e-5733-2af9-e2fb3d6ae0a4@gmail.com> (raw)
In-Reply-To: <1563466028-2531-1-git-send-email-yanhaishuang@cmss.chinamobile.com>

On 7/18/2019 9:07 AM, Haishuang Yan wrote:
> dst_cache should be destroyed when fail to add flow actions.
>
> Fixes: d71785ffc7e7 ("net: add dst_cache to ovs vxlan lwtunnel")
> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> ---
>   net/openvswitch/flow_netlink.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
> index d7559c6..1fd1cdd 100644
> --- a/net/openvswitch/flow_netlink.c
> +++ b/net/openvswitch/flow_netlink.c
> @@ -2608,6 +2608,7 @@ static int validate_and_copy_set_tun(const struct nlattr *attr,
>   			 sizeof(*ovs_tun), log);
>   	if (IS_ERR(a)) {
>   		dst_release((struct dst_entry *)tun_dst);
> +		dst_cache_destroy(&tun_dst->u.tun_info.dst_cache);
>   		return PTR_ERR(a);
>   	}
>   

Nack.

dst_release will decrement the ref count and will 
call_rcu(&dst->rcu_head, dst_destroy_rcu) if the ref count is zero.  No 
other net drivers call dst_destroy SFAICT.

Haishuang,

are you trying to fix some specific problem here?

Thanks,

- Greg



  parent reply	other threads:[~2019-07-18 22:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 16:07 [PATCH] openvswitch: Fix a possible memory leak on dst_cache Haishuang Yan
2019-07-18 19:08 ` David Miller
2019-07-18 22:12 ` Gregory Rose [this message]
2019-07-19  1:43   ` Haishuang Yan

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=9b231232-dd6e-5733-2af9-e2fb3d6ae0a4@gmail.com \
    --to=gvrose8192@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    --cc=yanhaishuang@cmss.chinamobile.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