lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+FTKRkgVodoQaCXH632rXx04AEe2_dJkqPiCEdtG0zQA@mail.gmail.com>
Date:   Fri, 4 Aug 2023 12:42:48 +0200
From:   Eric Dumazet <edumazet@...gle.com>
To:     yang.yang29@....com.cn
Cc:     davem@...emloft.net, dsahern@...nel.org, kuba@...nel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] udp_tunnel_nic: add net device refcount tracker

On Fri, Aug 4, 2023 at 10:50 AM <yang.yang29@....com.cn> wrote:
>
> From: xu xin <xu.xin16@....com.cn>
>
> Add net device refcount tracker to udp_tunnel_nic.c.
>
> Signed-off-by: xu xin <xu.xin16@....com.cn>
> Reviewed-by: Yang Yang <yang.yang29@....com.cn>
> Cc: Kuang Mingfu <kuang.mingfu@....com.cn>
> ---
>  net/ipv4/udp_tunnel_nic.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c
> index 029219749785..ce8f5c82b0a1 100644
> --- a/net/ipv4/udp_tunnel_nic.c
> +++ b/net/ipv4/udp_tunnel_nic.c
> @@ -55,6 +55,9 @@ struct udp_tunnel_nic {
>   */
>  static struct workqueue_struct *udp_tunnel_nic_workqueue;
>
> +/* To track netdev_hold and netdev_put */
> +static netdevice_tracker udp_tunnel_nic_devtracker;

This looks wrong.

> +
>  static const char *udp_tunnel_nic_tunnel_type_name(unsigned int type)
>  {
>         switch (type) {
> @@ -825,7 +828,7 @@ static int udp_tunnel_nic_register(struct net_device *dev)
>         }
>
>         utn->dev = dev;
> -       dev_hold(dev);
> +       netdev_hold(dev, &udp_tunnel_nic_devtracker, GFP_KERNEL);

This is wrong. You need a separate netdevice_tracker per netdev_hold()

For instance, this would need to be in "(struct udp_tunnel_nic)->dev_tracker"


>         dev->udp_tunnel_nic = utn;
>
>         if (!(info->flags & UDP_TUNNEL_NIC_INFO_OPEN_ONLY))
> @@ -879,7 +882,7 @@ udp_tunnel_nic_unregister(struct net_device *dev, struct udp_tunnel_nic *utn)
>         udp_tunnel_nic_free(utn);
>  release_dev:
>         dev->udp_tunnel_nic = NULL;
> -       dev_put(dev);
> +       netdev_put(dev, &udp_tunnel_nic_devtracker);
>  }
>
>  static int
> --
> 2.15.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ