<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/net/netdevsim, branch linux-6.0.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-6.0.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-11-26T08:27:40+00:00</updated>
<entry>
<title>netdevsim: Fix memory leak of nsim_dev-&gt;fa_cookie</title>
<updated>2022-11-26T08:27:40+00:00</updated>
<author>
<name>Wang Yufen</name>
<email>wangyufen@huawei.com</email>
</author>
<published>2022-11-15T09:30:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=207edad5717e0a5709ce8467f0eff41c607835c9'/>
<id>urn:sha1:207edad5717e0a5709ce8467f0eff41c607835c9</id>
<content type='text'>
[ Upstream commit 064bc7312bd09a48798418663090be0c776183db ]

kmemleak reports this issue:

unreferenced object 0xffff8881bac872d0 (size 8):
  comm "sh", pid 58603, jiffies 4481524462 (age 68.065s)
  hex dump (first 8 bytes):
    04 00 00 00 de ad be ef                          ........
  backtrace:
    [&lt;00000000c80b8577&gt;] __kmalloc+0x49/0x150
    [&lt;000000005292b8c6&gt;] nsim_dev_trap_fa_cookie_write+0xc1/0x210 [netdevsim]
    [&lt;0000000093d78e77&gt;] full_proxy_write+0xf3/0x180
    [&lt;000000005a662c16&gt;] vfs_write+0x1c5/0xaf0
    [&lt;000000007aabf84a&gt;] ksys_write+0xed/0x1c0
    [&lt;000000005f1d2e47&gt;] do_syscall_64+0x3b/0x90
    [&lt;000000006001c6ec&gt;] entry_SYSCALL_64_after_hwframe+0x63/0xcd

The issue occurs in the following scenarios:

nsim_dev_trap_fa_cookie_write()
  kmalloc() fa_cookie
  nsim_dev-&gt;fa_cookie = fa_cookie
..
nsim_drv_remove()

The fa_cookie allocked in nsim_dev_trap_fa_cookie_write() is not freed. To
fix, add kfree(nsim_dev-&gt;fa_cookie) to nsim_drv_remove().

Fixes: d3cbb907ae57 ("netdevsim: add ACL trap reporting cookie as a metadata")
Signed-off-by: Wang Yufen &lt;wangyufen@huawei.com&gt;
Cc: Jiri Pirko &lt;jiri@mellanox.com&gt;
Link: https://lore.kernel.org/r/1668504625-14698-1-git-send-email-wangyufen@huawei.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>netdevsim: remove dir in nsim_dev_debugfs_init() when creating ports dir failed</title>
<updated>2022-11-03T15:00:33+00:00</updated>
<author>
<name>Zhengchao Shao</name>
<email>shaozhengchao@huawei.com</email>
</author>
<published>2022-10-26T01:46:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5f946eb3ae4e9a580372ac3762b9778ed487c8ca'/>
<id>urn:sha1:5f946eb3ae4e9a580372ac3762b9778ed487c8ca</id>
<content type='text'>
[ Upstream commit a6aa8d0ce2cfba57ac0f23293fcb3be0b9f53fba ]

Remove dir in nsim_dev_debugfs_init() when creating ports dir failed.
Otherwise, the netdevsim device will not be created next time. Kernel
reports an error: debugfs: Directory 'netdevsim1' with parent 'netdevsim'
already present!

Fixes: ab1d0cc004d7 ("netdevsim: change debugfs tree topology")
Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>netdevsim: fix memory leak in nsim_drv_probe() when nsim_dev_resources_register() failed</title>
<updated>2022-11-03T15:00:33+00:00</updated>
<author>
<name>Zhengchao Shao</name>
<email>shaozhengchao@huawei.com</email>
</author>
<published>2022-10-26T01:46:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7c4957fe40e2a628b7cceaf4c9bfb5b701774d05'/>
<id>urn:sha1:7c4957fe40e2a628b7cceaf4c9bfb5b701774d05</id>
<content type='text'>
[ Upstream commit 6b1da9f7126f05e857da6db24c6a04aa7974d644 ]

If some items in nsim_dev_resources_register() fail, memory leak will
occur. The following is the memory leak information.

unreferenced object 0xffff888074c02600 (size 128):
  comm "echo", pid 8159, jiffies 4294945184 (age 493.530s)
  hex dump (first 32 bytes):
    40 47 ea 89 ff ff ff ff 01 00 00 00 00 00 00 00  @G..............
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................
  backtrace:
    [&lt;0000000011a31c98&gt;] kmalloc_trace+0x22/0x60
    [&lt;0000000027384c69&gt;] devl_resource_register+0x144/0x4e0
    [&lt;00000000a16db248&gt;] nsim_drv_probe+0x37a/0x1260
    [&lt;000000007d1f448c&gt;] really_probe+0x20b/0xb10
    [&lt;00000000c416848a&gt;] __driver_probe_device+0x1b3/0x4a0
    [&lt;00000000077e0351&gt;] driver_probe_device+0x49/0x140
    [&lt;0000000054f2465a&gt;] __device_attach_driver+0x18c/0x2a0
    [&lt;000000008538f359&gt;] bus_for_each_drv+0x151/0x1d0
    [&lt;0000000038e09747&gt;] __device_attach+0x1c9/0x4e0
    [&lt;00000000dd86e533&gt;] bus_probe_device+0x1d5/0x280
    [&lt;00000000839bea35&gt;] device_add+0xae0/0x1cb0
    [&lt;000000009c2abf46&gt;] new_device_store+0x3b6/0x5f0
    [&lt;00000000fb823d7f&gt;] bus_attr_store+0x72/0xa0
    [&lt;000000007acc4295&gt;] sysfs_kf_write+0x106/0x160
    [&lt;000000005f50cb4d&gt;] kernfs_fop_write_iter+0x3a8/0x5a0
    [&lt;0000000075eb41bf&gt;] vfs_write+0x8f0/0xc80

Fixes: 37923ed6b8ce ("netdevsim: Add simple FIB resource controller via devlink")
Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>netdevsim: fix memory leak in nsim_bus_dev_new()</title>
<updated>2022-11-03T15:00:33+00:00</updated>
<author>
<name>Zhengchao Shao</name>
<email>shaozhengchao@huawei.com</email>
</author>
<published>2022-10-26T01:54:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=77579e4065295071fbd9662f03430dca5b50b086'/>
<id>urn:sha1:77579e4065295071fbd9662f03430dca5b50b086</id>
<content type='text'>
[ Upstream commit cf2010aa1c739bab067cbc90b690d28eaa0b47da ]

If device_register() failed in nsim_bus_dev_new(), the value of reference
in nsim_bus_dev-&gt;dev is 1. obj-&gt;name in nsim_bus_dev-&gt;dev will not be
released.

unreferenced object 0xffff88810352c480 (size 16):
  comm "echo", pid 5691, jiffies 4294945921 (age 133.270s)
  hex dump (first 16 bytes):
    6e 65 74 64 65 76 73 69 6d 31 00 00 00 00 00 00  netdevsim1......
  backtrace:
    [&lt;000000005e2e5e26&gt;] __kmalloc_node_track_caller+0x3a/0xb0
    [&lt;0000000094ca4fc8&gt;] kvasprintf+0xc3/0x160
    [&lt;00000000aad09bcc&gt;] kvasprintf_const+0x55/0x180
    [&lt;000000009bac868d&gt;] kobject_set_name_vargs+0x56/0x150
    [&lt;000000007c1a5d70&gt;] dev_set_name+0xbb/0xf0
    [&lt;00000000ad0d126b&gt;] device_add+0x1f8/0x1cb0
    [&lt;00000000c222ae24&gt;] new_device_store+0x3b6/0x5e0
    [&lt;0000000043593421&gt;] bus_attr_store+0x72/0xa0
    [&lt;00000000cbb1833a&gt;] sysfs_kf_write+0x106/0x160
    [&lt;00000000d0dedb8a&gt;] kernfs_fop_write_iter+0x3a8/0x5a0
    [&lt;00000000770b66e2&gt;] vfs_write+0x8f0/0xc80
    [&lt;0000000078bb39be&gt;] ksys_write+0x106/0x210
    [&lt;00000000005e55a4&gt;] do_syscall_64+0x35/0x80
    [&lt;00000000eaa40bbc&gt;] entry_SYSCALL_64_after_hwframe+0x46/0xb0

Fixes: 40e4fe4ce115 ("netdevsim: move device registration and related code to bus.c")
Signed-off-by: Zhengchao Shao &lt;shaozhengchao@huawei.com&gt;
Link: https://lore.kernel.org/r/20221026015405.128795-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>netdevsim: Fix hwstats debugfs file permissions</title>
<updated>2022-09-19T21:40:38+00:00</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@nvidia.com</email>
</author>
<published>2022-09-09T15:38:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=34513ada53eb3e3f711250d8dbc2de4de493d510'/>
<id>urn:sha1:34513ada53eb3e3f711250d8dbc2de4de493d510</id>
<content type='text'>
The hwstats debugfs files are only writeable, but they are created with
read and write permissions, causing certain selftests to fail [1].

Fix by creating the files with write permission only.

[1]
 # ./test_offload.py
 Test destruction of generic XDP...
 Traceback (most recent call last):
   File "/home/idosch/code/linux/tools/testing/selftests/bpf/./test_offload.py", line 810, in &lt;module&gt;
     simdev = NetdevSimDev()
 [...]
 Exception: Command failed: cat /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex

 cat: /sys/kernel/debug/netdevsim/netdevsim0//ports/0/dev/hwstats/l3/disable_ifindex: Invalid argument

Fixes: 1a6d7ae7d63c ("netdevsim: Introduce support for L3 offload xstats")
Reported-by: Jie2x Zhou &lt;jie2x.zhou@intel.com&gt;
Tested-by: Jie2x Zhou &lt;jie2x.zhou@intel.com&gt;
Signed-off-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: Petr Machata &lt;petrm@nvidia.com&gt;
Link: https://lore.kernel.org/r/20220909153830.3732504-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>net: Use u64_stats_fetch_begin_irq() for stats fetch.</title>
<updated>2022-08-29T12:02:27+00:00</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2022-08-25T11:36:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=278d3ba61563ceed3cb248383ced19e14ec7bc1f'/>
<id>urn:sha1:278d3ba61563ceed3cb248383ced19e14ec7bc1f</id>
<content type='text'>
On 32bit-UP u64_stats_fetch_begin() disables only preemption. If the
reader is in preemptible context and the writer side
(u64_stats_update_begin*()) runs in an interrupt context (IRQ or
softirq) then the writer can update the stats during the read operation.
This update remains undetected.

Use u64_stats_fetch_begin_irq() to ensure the stats fetch on 32bit-UP
are not interrupted by a writer. 32bit-SMP remains unaffected by this
change.

Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Catherine Sullivan &lt;csully@google.com&gt;
Cc: David Awogbemila &lt;awogbemila@google.com&gt;
Cc: Dimitris Michailidis &lt;dmichail@fungible.com&gt;
Cc: Eric Dumazet &lt;edumazet@google.com&gt;
Cc: Hans Ulli Kroll &lt;ulli.kroll@googlemail.com&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Jeroen de Borst &lt;jeroendb@google.com&gt;
Cc: Johannes Berg &lt;johannes@sipsolutions.net&gt;
Cc: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Cc: Paolo Abeni &lt;pabeni@redhat.com&gt;
Cc: Simon Horman &lt;simon.horman@corigine.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: oss-drivers@corigine.com
Cc: stable@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Reviewed-by: Simon Horman &lt;simon.horman@corigine.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net</title>
<updated>2022-08-03T07:04:55+00:00</updated>
<author>
<name>Paolo Abeni</name>
<email>pabeni@redhat.com</email>
</author>
<published>2022-08-03T06:50:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7c6327c77d509e78bff76f2a4551fcfee851682e'/>
<id>urn:sha1:7c6327c77d509e78bff76f2a4551fcfee851682e</id>
<content type='text'>
Conflicts:

net/ax25/af_ax25.c
  d7c4c9e075f8c ("ax25: fix incorrect dev_tracker usage")
  d62607c3fe459 ("net: rename reference+tracking helpers")

drivers/net/netdevsim/fib.c
  180a6a3ee60a ("netdevsim: fib: Fix reference count leak on route deletion failure")
  012ec02ae441 ("netdevsim: convert driver to use unlocked devlink API during init/fini")

Signed-off-by: Paolo Abeni &lt;pabeni@redhat.com&gt;
</content>
</entry>
<entry>
<title>net: devlink: convert reload command to take implicit devlink-&gt;lock</title>
<updated>2022-08-01T11:14:00+00:00</updated>
<author>
<name>Jiri Pirko</name>
<email>jiri@nvidia.com</email>
</author>
<published>2022-07-29T07:10:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=644a66c60f02f302d82c3008ae2ffe67cf495383'/>
<id>urn:sha1:644a66c60f02f302d82c3008ae2ffe67cf495383</id>
<content type='text'>
Convert reload command to behave the same way as the rest of the
commands and let if be called with devlink-&gt;lock held. Remove the
temporary devl_lock taking from drivers. As the DEVLINK_NL_FLAG_NO_LOCK
flag is no longer used, remove it alongside.

Signed-off-by: Jiri Pirko &lt;jiri@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>netdevsim: Avoid allocation warnings triggered from user space</title>
<updated>2022-07-29T21:57:26+00:00</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2022-07-26T21:36:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d0b80a9edb1a029ff913e81b47540e57ad034329'/>
<id>urn:sha1:d0b80a9edb1a029ff913e81b47540e57ad034329</id>
<content type='text'>
We need to suppress warnings from sily map sizes. Also switch
from GFP_USER to GFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood
the flags when writing this code.

Fixes: 395cacb5f1a0 ("netdevsim: bpf: support fake map offload")
Reported-by: syzbot+ad24705d3fd6463b18c6@syzkaller.appspotmail.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20220726213605.154204-1-kuba@kernel.org
</content>
</entry>
<entry>
<title>netdevsim: fib: Add debugfs knob to simulate route deletion failure</title>
<updated>2022-07-29T11:21:02+00:00</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@nvidia.com</email>
</author>
<published>2022-07-28T11:45:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=974be75f250378a6913c7bb268adbfd9a76a6df9'/>
<id>urn:sha1:974be75f250378a6913c7bb268adbfd9a76a6df9</id>
<content type='text'>
The previous patch ("netdevsim: fib: Fix reference count leak on route
deletion failure") fixed a reference count leak that happens on route
deletion failure.

Such failures can only be simulated by injecting slab allocation
failures, which cannot be surgically injected.

In order to be able to specifically test this scenario, add a debugfs
knob that allows user space to fail route deletion requests when
enabled.

Signed-off-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Reviewed-by: Amit Cohen &lt;amcohen@nvidia.com&gt;
Reviewed-by: David Ahern &lt;dsahern@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
