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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAChDUfSxwQXRTKY35zEPzY4hh+=E5r62DtMMxJw3yCs_2B9MTw@mail.gmail.com>
Date:	Mon, 15 Sep 2014 14:18:43 +0400
From:	"Alexander Y. Fomichev" <git.user@...il.com>
To:	David Miller <davem@...emloft.net>
Cc:	vyasevich@...il.com, netdev <netdev@...r.kernel.org>,
	Cong Wang <cwang@...pensource.com>, vyasevic@...hat.com,
	Andres Freund <andres@...razel.de>
Subject: Re: [PATCH net] net: fix sysfs symlinks of adjacent devices

tnx, i had thinking move it to netdev_adjacent_sysfs_add/del.. but
this is better.

On Mon, Sep 15, 2014 at 1:45 AM, David Miller <davem@...emloft.net> wrote:
> From: Vlad Yasevich <vyasevich@...il.com>
> Date: Fri, 12 Sep 2014 09:33:39 -0400
>
>> Looking over the code, it might make sense to move all the net_eq checks
>> into adjacent_sysfs calls so as to consolidate them.  I haven't audited
>> all code paths, but at first glance it should do the right thing.
>>
>> What do you think?
>
> Agreed, let's do the following then?
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index ab9a165..a70e49e 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4809,9 +4809,14 @@ static void netdev_adjacent_sysfs_del(struct net_device *dev,
>         sysfs_remove_link(&(dev->dev.kobj), linkname);
>  }
>
> -#define netdev_adjacent_is_neigh_list(dev, dev_list) \
> -               (dev_list == &dev->adj_list.upper || \
> -                dev_list == &dev->adj_list.lower)
> +static bool netdev_adjacent_is_neigh_list(struct net_device *dev,
> +                                         struct net_device *adj_dev,
> +                                         struct list_head *dev_list)
> +{
> +       return (dev_list == &dev->adj_list.upper ||
> +               dev_list == &dev->adj_list.lower) &&
> +               net_eq(dev_net(dev), dev_net(adj_dev));
> +}
>
>  static int __netdev_adjacent_dev_insert(struct net_device *dev,
>                                         struct net_device *adj_dev,
> @@ -4841,7 +4846,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
>         pr_debug("dev_hold for %s, because of link added from %s to %s\n",
>                  adj_dev->name, dev->name, adj_dev->name);
>
> -       if (netdev_adjacent_is_neigh_list(dev, dev_list)) {
> +       if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list)) {
>                 ret = netdev_adjacent_sysfs_add(dev, adj_dev, dev_list);
>                 if (ret)
>                         goto free_adj;
> @@ -4862,7 +4867,7 @@ static int __netdev_adjacent_dev_insert(struct net_device *dev,
>         return 0;
>
>  remove_symlinks:
> -       if (netdev_adjacent_is_neigh_list(dev, dev_list))
> +       if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list))
>                 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
>  free_adj:
>         kfree(adj);
> @@ -4895,8 +4900,7 @@ static void __netdev_adjacent_dev_remove(struct net_device *dev,
>         if (adj->master)
>                 sysfs_remove_link(&(dev->dev.kobj), "master");
>
> -       if (netdev_adjacent_is_neigh_list(dev, dev_list) &&
> -           net_eq(dev_net(dev),dev_net(adj_dev)))
> +       if (netdev_adjacent_is_neigh_list(dev, adj_dev, dev_list))
>                 netdev_adjacent_sysfs_del(dev, adj_dev->name, dev_list);
>
>         list_del_rcu(&adj->list);



-- 
Best regards.
       Alexander Y. Fomichev <git.user@...il.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ