Re: [PATCH v1 01/25] net: core: device_rename: Use rwsem instead of a seqcount

Ahmed S. Darwish
2020-05-25T16:22:27Z

On Wed, May 20, 2020 at 05:37:07PM +0300, Dan Carpenter wrote:
...
>
> smatch warnings:
> net/core/dev.c:953 netdev_get_name() warn: inconsistent returns 'devnet_rename_sem'.
>
...
>
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 935 int netdev_get_name(struct net *net, char *name, int ifindex)
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 936 {
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 937 struct net_device *dev;
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 938
> 2354e271ada778b Ahmed S. Darwish 2020-05-19 939 down_read(&devnet_rename_sem);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> 2354e271ada778b Ahmed S. Darwish 2020-05-19 940
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 941 rcu_read_lock();
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 942 dev = dev_get_by_index_rcu(net, ifindex);
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 943 if (!dev) {
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 944 rcu_read_unlock();
> 5dbe7c178d3f0a4 Nicolas Schichan 2013-06-26 945 return -ENODEV;
> ^^^^^^^^^^^^^^

Oh, shouldn't have missed that. Will fix in v2.

Thanks,