<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/net/core/net-sysfs.c, branch v5.1</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Revert "net-sysfs: Fix memory leak in netdev_register_kobject"</title>
<updated>2019-04-15T20:10:27+00:00</updated>
<author>
<name>Wang Hai</name>
<email>wanghai26@huawei.com</email>
</author>
<published>2019-04-12T20:36:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=8ed633b9baf9ec7d593ebb8e256312ff1c70ab37'/>
<id>8ed633b9baf9ec7d593ebb8e256312ff1c70ab37</id>
<content type='text'>
This reverts commit 6b70fc94afd165342876e53fc4b2f7d085009945.

The reverted bugfix will cause another issue.
Reported by syzbot+6024817a931b2830bc93@syzkaller.appspotmail.com.
See https://syzkaller.appspot.com/x/log.txt?x=1737671b200000 for
details.

Signed-off-by: Wang Hai &lt;wanghai26@huawei.com&gt;
Acked-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 6b70fc94afd165342876e53fc4b2f7d085009945.

The reverted bugfix will cause another issue.
Reported by syzbot+6024817a931b2830bc93@syzkaller.appspotmail.com.
See https://syzkaller.appspot.com/x/log.txt?x=1737671b200000 for
details.

Signed-off-by: Wang Hai &lt;wanghai26@huawei.com&gt;
Acked-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net-sysfs: Fix memory leak in netdev_register_kobject</title>
<updated>2019-03-21T20:38:27+00:00</updated>
<author>
<name>Wang Hai</name>
<email>wanghai26@huawei.com</email>
</author>
<published>2019-03-20T18:25:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6b70fc94afd165342876e53fc4b2f7d085009945'/>
<id>6b70fc94afd165342876e53fc4b2f7d085009945</id>
<content type='text'>
When registering struct net_device, it will call
	register_netdevice -&gt;
		netdev_register_kobject -&gt;
			device_initialize(dev);
			dev_set_name(dev, "%s", ndev-&gt;name)
			device_add(dev)
			register_queue_kobjects(ndev)

In netdev_register_kobject(), if device_add(dev) or
register_queue_kobjects(ndev) failed. Register_netdevice()
will return error, causing netdev_freemem(ndev) to be
called to free net_device, however put_device(&amp;dev-&gt;dev)-&gt;..-&gt;
kobject_cleanup() won't be called, resulting in a memory leak.

syzkaller report this:
BUG: memory leak
unreferenced object 0xffff8881f4fad168 (size 8):
comm "syz-executor.0", pid 3575, jiffies 4294778002 (age 20.134s)
hex dump (first 8 bytes):
  77 70 61 6e 30 00 ff ff                          wpan0...
backtrace:
  [&lt;000000006d2d91d7&gt;] kstrdup_const+0x3d/0x50 mm/util.c:73
  [&lt;00000000ba9ff953&gt;] kvasprintf_const+0x112/0x170 lib/kasprintf.c:48
  [&lt;000000005555ec09&gt;] kobject_set_name_vargs+0x55/0x130 lib/kobject.c:281
  [&lt;0000000098d28ec3&gt;] dev_set_name+0xbb/0xf0 drivers/base/core.c:1915
  [&lt;00000000b7553017&gt;] netdev_register_kobject+0xc0/0x410 net/core/net-sysfs.c:1727
  [&lt;00000000c826a797&gt;] register_netdevice+0xa51/0xeb0 net/core/dev.c:8711
  [&lt;00000000857bfcfd&gt;] cfg802154_update_iface_num.isra.2+0x13/0x90 [ieee802154]
  [&lt;000000003126e453&gt;] ieee802154_llsec_fill_key_id+0x1d5/0x570 [ieee802154]
  [&lt;00000000e4b3df51&gt;] 0xffffffffc1500e0e
  [&lt;00000000b4319776&gt;] platform_drv_probe+0xc6/0x180 drivers/base/platform.c:614
  [&lt;0000000037669347&gt;] really_probe+0x491/0x7c0 drivers/base/dd.c:509
  [&lt;000000008fed8862&gt;] driver_probe_device+0xdc/0x240 drivers/base/dd.c:671
  [&lt;00000000baf52041&gt;] device_driver_attach+0xf2/0x130 drivers/base/dd.c:945
  [&lt;00000000c7cc8dec&gt;] __driver_attach+0x10e/0x210 drivers/base/dd.c:1022
  [&lt;0000000057a757c2&gt;] bus_for_each_dev+0x154/0x1e0 drivers/base/bus.c:304
  [&lt;000000005f5ae04b&gt;] bus_add_driver+0x427/0x5e0 drivers/base/bus.c:645

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
Signed-off-by: Wang Hai &lt;wanghai26@huawei.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When registering struct net_device, it will call
	register_netdevice -&gt;
		netdev_register_kobject -&gt;
			device_initialize(dev);
			dev_set_name(dev, "%s", ndev-&gt;name)
			device_add(dev)
			register_queue_kobjects(ndev)

In netdev_register_kobject(), if device_add(dev) or
register_queue_kobjects(ndev) failed. Register_netdevice()
will return error, causing netdev_freemem(ndev) to be
called to free net_device, however put_device(&amp;dev-&gt;dev)-&gt;..-&gt;
kobject_cleanup() won't be called, resulting in a memory leak.

syzkaller report this:
BUG: memory leak
unreferenced object 0xffff8881f4fad168 (size 8):
comm "syz-executor.0", pid 3575, jiffies 4294778002 (age 20.134s)
hex dump (first 8 bytes):
  77 70 61 6e 30 00 ff ff                          wpan0...
backtrace:
  [&lt;000000006d2d91d7&gt;] kstrdup_const+0x3d/0x50 mm/util.c:73
  [&lt;00000000ba9ff953&gt;] kvasprintf_const+0x112/0x170 lib/kasprintf.c:48
  [&lt;000000005555ec09&gt;] kobject_set_name_vargs+0x55/0x130 lib/kobject.c:281
  [&lt;0000000098d28ec3&gt;] dev_set_name+0xbb/0xf0 drivers/base/core.c:1915
  [&lt;00000000b7553017&gt;] netdev_register_kobject+0xc0/0x410 net/core/net-sysfs.c:1727
  [&lt;00000000c826a797&gt;] register_netdevice+0xa51/0xeb0 net/core/dev.c:8711
  [&lt;00000000857bfcfd&gt;] cfg802154_update_iface_num.isra.2+0x13/0x90 [ieee802154]
  [&lt;000000003126e453&gt;] ieee802154_llsec_fill_key_id+0x1d5/0x570 [ieee802154]
  [&lt;00000000e4b3df51&gt;] 0xffffffffc1500e0e
  [&lt;00000000b4319776&gt;] platform_drv_probe+0xc6/0x180 drivers/base/platform.c:614
  [&lt;0000000037669347&gt;] really_probe+0x491/0x7c0 drivers/base/dd.c:509
  [&lt;000000008fed8862&gt;] driver_probe_device+0xdc/0x240 drivers/base/dd.c:671
  [&lt;00000000baf52041&gt;] device_driver_attach+0xf2/0x130 drivers/base/dd.c:945
  [&lt;00000000c7cc8dec&gt;] __driver_attach+0x10e/0x210 drivers/base/dd.c:1022
  [&lt;0000000057a757c2&gt;] bus_for_each_dev+0x154/0x1e0 drivers/base/bus.c:304
  [&lt;000000005f5ae04b&gt;] bus_add_driver+0x427/0x5e0 drivers/base/bus.c:645

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
Signed-off-by: Wang Hai &lt;wanghai26@huawei.com&gt;
Reviewed-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Stephen Hemminger &lt;stephen@networkplumber.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net-sysfs: call dev_hold if kobject_init_and_add success</title>
<updated>2019-03-19T20:45:58+00:00</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2019-03-19T02:16:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a3e23f719f5c4a38ffb3d30c8d7632a4ed8ccd9e'/>
<id>a3e23f719f5c4a38ffb3d30c8d7632a4ed8ccd9e</id>
<content type='text'>
In netdev_queue_add_kobject and rx_queue_add_kobject,
if sysfs_create_group failed, kobject_put will call
netdev_queue_release to decrease dev refcont, however
dev_hold has not be called. So we will see this while
unregistering dev:

unregister_netdevice: waiting for bcsh0 to become free. Usage count = -1

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Fixes: d0d668371679 ("net: don't decrement kobj reference count on init failure")
Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In netdev_queue_add_kobject and rx_queue_add_kobject,
if sysfs_create_group failed, kobject_put will call
netdev_queue_release to decrease dev refcont, however
dev_hold has not be called. So we will see this while
unregistering dev:

unregister_netdevice: waiting for bcsh0 to become free. Usage count = -1

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Fixes: d0d668371679 ("net: don't decrement kobj reference count on init failure")
Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2019-03-04T21:26:15+00:00</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2019-03-04T21:26:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=18a4d8bf250a33c015955f0dec27259780ef6448'/>
<id>18a4d8bf250a33c015955f0dec27259780ef6448</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>net-sysfs: Switch to bitmap_zalloc()</title>
<updated>2019-03-04T18:20:39+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2019-03-04T09:48:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=29ca1c5a4b4b4da8741f1a1204c3ab22f3cb1059'/>
<id>29ca1c5a4b4b4da8741f1a1204c3ab22f3cb1059</id>
<content type='text'>
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.

Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net-sysfs: Fix mem leak in netdev_register_kobject</title>
<updated>2019-03-04T05:10:57+00:00</updated>
<author>
<name>YueHaibing</name>
<email>yuehaibing@huawei.com</email>
</author>
<published>2019-03-02T02:34:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=895a5e96dbd6386c8e78e5b78e067dcc67b7f0ab'/>
<id>895a5e96dbd6386c8e78e5b78e067dcc67b7f0ab</id>
<content type='text'>
syzkaller report this:
BUG: memory leak
unreferenced object 0xffff88837a71a500 (size 256):
  comm "syz-executor.2", pid 9770, jiffies 4297825125 (age 17.843s)
  hex dump (first 32 bytes):
    00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
    ff ff ff ff ff ff ff ff 20 c0 ef 86 ff ff ff ff  ........ .......
  backtrace:
    [&lt;00000000db12624b&gt;] netdev_register_kobject+0x124/0x2e0 net/core/net-sysfs.c:1751
    [&lt;00000000dc49a994&gt;] register_netdevice+0xcc1/0x1270 net/core/dev.c:8516
    [&lt;00000000e5f3fea0&gt;] tun_set_iff drivers/net/tun.c:2649 [inline]
    [&lt;00000000e5f3fea0&gt;] __tun_chr_ioctl+0x2218/0x3d20 drivers/net/tun.c:2883
    [&lt;000000001b8ac127&gt;] vfs_ioctl fs/ioctl.c:46 [inline]
    [&lt;000000001b8ac127&gt;] do_vfs_ioctl+0x1a5/0x10e0 fs/ioctl.c:690
    [&lt;0000000079b269f8&gt;] ksys_ioctl+0x89/0xa0 fs/ioctl.c:705
    [&lt;00000000de649beb&gt;] __do_sys_ioctl fs/ioctl.c:712 [inline]
    [&lt;00000000de649beb&gt;] __se_sys_ioctl fs/ioctl.c:710 [inline]
    [&lt;00000000de649beb&gt;] __x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:710
    [&lt;000000007ebded1e&gt;] do_syscall_64+0xc8/0x580 arch/x86/entry/common.c:290
    [&lt;00000000db315d36&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [&lt;00000000115be9bb&gt;] 0xffffffffffffffff

It should call kset_unregister to free 'dev-&gt;queues_kset'
in error path of register_queue_kobjects, otherwise will cause a mem leak.

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Fixes: 1d24eb4815d1 ("xps: Transmit Packet Steering")
Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
syzkaller report this:
BUG: memory leak
unreferenced object 0xffff88837a71a500 (size 256):
  comm "syz-executor.2", pid 9770, jiffies 4297825125 (age 17.843s)
  hex dump (first 32 bytes):
    00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
    ff ff ff ff ff ff ff ff 20 c0 ef 86 ff ff ff ff  ........ .......
  backtrace:
    [&lt;00000000db12624b&gt;] netdev_register_kobject+0x124/0x2e0 net/core/net-sysfs.c:1751
    [&lt;00000000dc49a994&gt;] register_netdevice+0xcc1/0x1270 net/core/dev.c:8516
    [&lt;00000000e5f3fea0&gt;] tun_set_iff drivers/net/tun.c:2649 [inline]
    [&lt;00000000e5f3fea0&gt;] __tun_chr_ioctl+0x2218/0x3d20 drivers/net/tun.c:2883
    [&lt;000000001b8ac127&gt;] vfs_ioctl fs/ioctl.c:46 [inline]
    [&lt;000000001b8ac127&gt;] do_vfs_ioctl+0x1a5/0x10e0 fs/ioctl.c:690
    [&lt;0000000079b269f8&gt;] ksys_ioctl+0x89/0xa0 fs/ioctl.c:705
    [&lt;00000000de649beb&gt;] __do_sys_ioctl fs/ioctl.c:712 [inline]
    [&lt;00000000de649beb&gt;] __se_sys_ioctl fs/ioctl.c:710 [inline]
    [&lt;00000000de649beb&gt;] __x64_sys_ioctl+0x74/0xb0 fs/ioctl.c:710
    [&lt;000000007ebded1e&gt;] do_syscall_64+0xc8/0x580 arch/x86/entry/common.c:290
    [&lt;00000000db315d36&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [&lt;00000000115be9bb&gt;] 0xffffffffffffffff

It should call kset_unregister to free 'dev-&gt;queues_kset'
in error path of register_queue_kobjects, otherwise will cause a mem leak.

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Fixes: 1d24eb4815d1 ("xps: Transmit Packet Steering")
Signed-off-by: YueHaibing &lt;yuehaibing@huawei.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID</title>
<updated>2019-02-06T22:17:03+00:00</updated>
<author>
<name>Florian Fainelli</name>
<email>f.fainelli@gmail.com</email>
</author>
<published>2019-02-06T17:45:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=bccb30254a4a02ee370dd23b2afbd25d7a78bc34'/>
<id>bccb30254a4a02ee370dd23b2afbd25d7a78bc34</id>
<content type='text'>
Now that we have a dedicated NDO for getting a port's parent ID, get rid
of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
NDO exclusively. This is a preliminary change to getting rid of
switchdev_ops eventually.

Signed-off-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we have a dedicated NDO for getting a port's parent ID, get rid
of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
NDO exclusively. This is a preliminary change to getting rid of
switchdev_ops eventually.

Signed-off-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: Introduce ndo_get_port_parent_id()</title>
<updated>2019-02-06T22:16:11+00:00</updated>
<author>
<name>Florian Fainelli</name>
<email>f.fainelli@gmail.com</email>
</author>
<published>2019-02-06T17:45:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=d6abc5969463359c366d459247b90366fcd6f5c5'/>
<id>d6abc5969463359c366d459247b90366fcd6f5c5</id>
<content type='text'>
In preparation for getting rid of switchdev_ops, create a dedicated NDO
operation for getting the port's parent identifier. There are
essentially two classes of drivers that need to implement getting the
port's parent ID which are VF/PF drivers with a built-in switch, and
pure switchdev drivers such as mlxsw, ocelot, dsa etc.

We introduce a helper function: dev_get_port_parent_id() which supports
recursion into the lower devices to obtain the first port's parent ID.

Convert the bridge, core and ipv4 multicast routing code to check for
such ndo_get_port_parent_id() and call the helper function when valid
before falling back to switchdev_port_attr_get(). This will allow us to
convert all relevant drivers in one go instead of having to implement
both switchdev_port_attr_get() and ndo_get_port_parent_id() operations,
then get rid of switchdev_port_attr_get().

Acked-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In preparation for getting rid of switchdev_ops, create a dedicated NDO
operation for getting the port's parent identifier. There are
essentially two classes of drivers that need to implement getting the
port's parent ID which are VF/PF drivers with a built-in switch, and
pure switchdev drivers such as mlxsw, ocelot, dsa etc.

We introduce a helper function: dev_get_port_parent_id() which supports
recursion into the lower devices to obtain the first port's parent ID.

Convert the bridge, core and ipv4 multicast routing code to check for
such ndo_get_port_parent_id() and call the helper function when valid
before falling back to switchdev_port_attr_get(). This will allow us to
convert all relevant drivers in one go instead of having to implement
both switchdev_port_attr_get() and ndo_get_port_parent_id() operations,
then get rid of switchdev_port_attr_get().

Acked-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Signed-off-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: core: dev: Add extack argument to dev_change_flags()</title>
<updated>2018-12-06T21:26:07+00:00</updated>
<author>
<name>Petr Machata</name>
<email>petrm@mellanox.com</email>
</author>
<published>2018-12-06T17:05:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=567c5e13be5cc74d24f5eb54cf353c2e2277189b'/>
<id>567c5e13be5cc74d24f5eb54cf353c2e2277189b</id>
<content type='text'>
In order to pass extack together with NETDEV_PRE_UP notifications, it's
necessary to route the extack to __dev_open() from diverse (possibly
indirect) callers. One prominent API through which the notification is
invoked is dev_change_flags().

Therefore extend dev_change_flags() with and extra extack argument and
update all users. Most of the calls end up just encoding NULL, but
several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.

Since the function declaration line is changed anyway, name the other
function arguments to placate checkpatch.

Signed-off-by: Petr Machata &lt;petrm@mellanox.com&gt;
Acked-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Reviewed-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to pass extack together with NETDEV_PRE_UP notifications, it's
necessary to route the extack to __dev_open() from diverse (possibly
indirect) callers. One prominent API through which the notification is
invoked is dev_change_flags().

Therefore extend dev_change_flags() with and extra extack argument and
update all users. Most of the calls end up just encoding NULL, but
several sites (VLAN, ipvlan, VRF, rtnetlink) do have extack available.

Since the function declaration line is changed anyway, name the other
function arguments to placate checkpatch.

Signed-off-by: Petr Machata &lt;petrm@mellanox.com&gt;
Acked-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
Reviewed-by: Ido Schimmel &lt;idosch@mellanox.com&gt;
Reviewed-by: David Ahern &lt;dsahern@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>net: allow to call netif_reset_xps_queues() under cpus_read_lock</title>
<updated>2018-08-09T21:25:06+00:00</updated>
<author>
<name>Andrei Vagin</name>
<email>avagin@gmail.com</email>
</author>
<published>2018-08-09T03:07:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=4d99f6602cb552fb58db0c3b1d935bb6fa017f24'/>
<id>4d99f6602cb552fb58db0c3b1d935bb6fa017f24</id>
<content type='text'>
The definition of static_key_slow_inc() has cpus_read_lock in place. In the
virtio_net driver, XPS queues are initialized after setting the queue:cpu
affinity in virtnet_set_affinity() which is already protected within
cpus_read_lock. Lockdep prints a warning when we are trying to acquire
cpus_read_lock when it is already held.

This patch adds an ability to call __netif_set_xps_queue under
cpus_read_lock().
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;

============================================
WARNING: possible recursive locking detected
4.18.0-rc3-next-20180703+ #1 Not tainted
--------------------------------------------
swapper/0/1 is trying to acquire lock:
00000000cf973d46 (cpu_hotplug_lock.rw_sem){++++}, at: static_key_slow_inc+0xe/0x20

but task is already holding lock:
00000000cf973d46 (cpu_hotplug_lock.rw_sem){++++}, at: init_vqs+0x513/0x5a0

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(cpu_hotplug_lock.rw_sem);
  lock(cpu_hotplug_lock.rw_sem);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by swapper/0/1:
 #0: 00000000244bc7da (&amp;dev-&gt;mutex){....}, at: __driver_attach+0x5a/0x110
 #1: 00000000cf973d46 (cpu_hotplug_lock.rw_sem){++++}, at: init_vqs+0x513/0x5a0
 #2: 000000005cd8463f (xps_map_mutex){+.+.}, at: __netif_set_xps_queue+0x8d/0xc60

v2: move cpus_read_lock() out of __netif_set_xps_queue()

Cc: "Nambiar, Amritha" &lt;amritha.nambiar@intel.com&gt;
Cc: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Cc: Jason Wang &lt;jasowang@redhat.com&gt;
Fixes: 8af2c06ff4b1 ("net-sysfs: Add interface for Rx queue(s) map per Tx queue")

Signed-off-by: Andrei Vagin &lt;avagin@gmail.com&gt;

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The definition of static_key_slow_inc() has cpus_read_lock in place. In the
virtio_net driver, XPS queues are initialized after setting the queue:cpu
affinity in virtnet_set_affinity() which is already protected within
cpus_read_lock. Lockdep prints a warning when we are trying to acquire
cpus_read_lock when it is already held.

This patch adds an ability to call __netif_set_xps_queue under
cpus_read_lock().
Acked-by: Jason Wang &lt;jasowang@redhat.com&gt;

============================================
WARNING: possible recursive locking detected
4.18.0-rc3-next-20180703+ #1 Not tainted
--------------------------------------------
swapper/0/1 is trying to acquire lock:
00000000cf973d46 (cpu_hotplug_lock.rw_sem){++++}, at: static_key_slow_inc+0xe/0x20

but task is already holding lock:
00000000cf973d46 (cpu_hotplug_lock.rw_sem){++++}, at: init_vqs+0x513/0x5a0

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(cpu_hotplug_lock.rw_sem);
  lock(cpu_hotplug_lock.rw_sem);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by swapper/0/1:
 #0: 00000000244bc7da (&amp;dev-&gt;mutex){....}, at: __driver_attach+0x5a/0x110
 #1: 00000000cf973d46 (cpu_hotplug_lock.rw_sem){++++}, at: init_vqs+0x513/0x5a0
 #2: 000000005cd8463f (xps_map_mutex){+.+.}, at: __netif_set_xps_queue+0x8d/0xc60

v2: move cpus_read_lock() out of __netif_set_xps_queue()

Cc: "Nambiar, Amritha" &lt;amritha.nambiar@intel.com&gt;
Cc: "Michael S. Tsirkin" &lt;mst@redhat.com&gt;
Cc: Jason Wang &lt;jasowang@redhat.com&gt;
Fixes: 8af2c06ff4b1 ("net-sysfs: Add interface for Rx queue(s) map per Tx queue")

Signed-off-by: Andrei Vagin &lt;avagin@gmail.com&gt;

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</pre>
</div>
</content>
</entry>
</feed>
