<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/arch/um/drivers/vector_kern.c, branch for-next</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>um: vector: Do not use drvdata in release</title>
<updated>2024-11-07T17:05:22+00:00</updated>
<author>
<name>Tiwei Bie</name>
<email>tiwei.btw@antgroup.com</email>
</author>
<published>2024-11-04T16:32:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=51b39d741970742a5c41136241a9c48ac607cf82'/>
<id>51b39d741970742a5c41136241a9c48ac607cf82</id>
<content type='text'>
The drvdata is not available in release. Let's just use container_of()
to get the vector_device instance. Otherwise, removing a vector device
will result in a crash:

RIP: 0033:vector_device_release+0xf/0x50
RSP: 00000000e187bc40  EFLAGS: 00010202
RAX: 0000000060028f61 RBX: 00000000600f1baf RCX: 00000000620074e0
RDX: 000000006220b9c0 RSI: 0000000060551c80 RDI: 0000000000000000
RBP: 00000000e187bc50 R08: 00000000603ad594 R09: 00000000e187bb70
R10: 000000000000135a R11: 00000000603ad422 R12: 00000000623ae028
R13: 000000006287a200 R14: 0000000062006d30 R15: 00000000623700b6
Kernel panic - not syncing: Segfault with no mm
CPU: 0 UID: 0 PID: 16 Comm: kworker/0:1 Not tainted 6.12.0-rc6-g59b723cd2adb #1
Workqueue: events mc_work_proc
Stack:
 60028f61 623ae028 e187bc80 60276fcd
 6220b9c0 603f5820 623ae028 00000000
 e187bcb0 603a2bcd 623ae000 62370010
Call Trace:
 [&lt;60028f61&gt;] ? vector_device_release+0x0/0x50
 [&lt;60276fcd&gt;] device_release+0x70/0xba
 [&lt;603a2bcd&gt;] kobject_put+0xba/0xe7
 [&lt;60277265&gt;] put_device+0x19/0x1c
 [&lt;60281266&gt;] platform_device_put+0x26/0x29
 [&lt;60281e5f&gt;] platform_device_unregister+0x2c/0x2e
 [&lt;60029422&gt;] vector_remove+0x52/0x58
 [&lt;60031316&gt;] ? mconsole_reply+0x0/0x50
 [&lt;600310c8&gt;] mconsole_remove+0x160/0x1cc
 [&lt;603b19f4&gt;] ? strlen+0x0/0x15
 [&lt;60066611&gt;] ? __dequeue_entity+0x1a9/0x206
 [&lt;600666a7&gt;] ? set_next_entity+0x39/0x63
 [&lt;6006666e&gt;] ? set_next_entity+0x0/0x63
 [&lt;60038fa6&gt;] ? um_set_signals+0x0/0x43
 [&lt;6003070c&gt;] mc_work_proc+0x77/0x91
 [&lt;60057664&gt;] process_scheduled_works+0x1b3/0x2dd
 [&lt;60055f32&gt;] ? assign_work+0x0/0x58
 [&lt;60057f0a&gt;] worker_thread+0x1e9/0x293
 [&lt;6005406f&gt;] ? set_pf_worker+0x0/0x64
 [&lt;6005d65d&gt;] ? arch_local_irq_save+0x0/0x2d
 [&lt;6005d748&gt;] ? kthread_exit+0x0/0x3a
 [&lt;60057d21&gt;] ? worker_thread+0x0/0x293
 [&lt;6005dbf1&gt;] kthread+0x126/0x12b
 [&lt;600219c5&gt;] new_thread_handler+0x85/0xb6

Cc: stable@vger.kernel.org
Signed-off-by: Tiwei Bie &lt;tiwei.btw@antgroup.com&gt;
Acked-By: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Link: https://patch.msgid.link/20241104163203.435515-5-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The drvdata is not available in release. Let's just use container_of()
to get the vector_device instance. Otherwise, removing a vector device
will result in a crash:

RIP: 0033:vector_device_release+0xf/0x50
RSP: 00000000e187bc40  EFLAGS: 00010202
RAX: 0000000060028f61 RBX: 00000000600f1baf RCX: 00000000620074e0
RDX: 000000006220b9c0 RSI: 0000000060551c80 RDI: 0000000000000000
RBP: 00000000e187bc50 R08: 00000000603ad594 R09: 00000000e187bb70
R10: 000000000000135a R11: 00000000603ad422 R12: 00000000623ae028
R13: 000000006287a200 R14: 0000000062006d30 R15: 00000000623700b6
Kernel panic - not syncing: Segfault with no mm
CPU: 0 UID: 0 PID: 16 Comm: kworker/0:1 Not tainted 6.12.0-rc6-g59b723cd2adb #1
Workqueue: events mc_work_proc
Stack:
 60028f61 623ae028 e187bc80 60276fcd
 6220b9c0 603f5820 623ae028 00000000
 e187bcb0 603a2bcd 623ae000 62370010
Call Trace:
 [&lt;60028f61&gt;] ? vector_device_release+0x0/0x50
 [&lt;60276fcd&gt;] device_release+0x70/0xba
 [&lt;603a2bcd&gt;] kobject_put+0xba/0xe7
 [&lt;60277265&gt;] put_device+0x19/0x1c
 [&lt;60281266&gt;] platform_device_put+0x26/0x29
 [&lt;60281e5f&gt;] platform_device_unregister+0x2c/0x2e
 [&lt;60029422&gt;] vector_remove+0x52/0x58
 [&lt;60031316&gt;] ? mconsole_reply+0x0/0x50
 [&lt;600310c8&gt;] mconsole_remove+0x160/0x1cc
 [&lt;603b19f4&gt;] ? strlen+0x0/0x15
 [&lt;60066611&gt;] ? __dequeue_entity+0x1a9/0x206
 [&lt;600666a7&gt;] ? set_next_entity+0x39/0x63
 [&lt;6006666e&gt;] ? set_next_entity+0x0/0x63
 [&lt;60038fa6&gt;] ? um_set_signals+0x0/0x43
 [&lt;6003070c&gt;] mc_work_proc+0x77/0x91
 [&lt;60057664&gt;] process_scheduled_works+0x1b3/0x2dd
 [&lt;60055f32&gt;] ? assign_work+0x0/0x58
 [&lt;60057f0a&gt;] worker_thread+0x1e9/0x293
 [&lt;6005406f&gt;] ? set_pf_worker+0x0/0x64
 [&lt;6005d65d&gt;] ? arch_local_irq_save+0x0/0x2d
 [&lt;6005d748&gt;] ? kthread_exit+0x0/0x3a
 [&lt;60057d21&gt;] ? worker_thread+0x0/0x293
 [&lt;6005dbf1&gt;] kthread+0x126/0x12b
 [&lt;600219c5&gt;] new_thread_handler+0x85/0xb6

Cc: stable@vger.kernel.org
Signed-off-by: Tiwei Bie &lt;tiwei.btw@antgroup.com&gt;
Acked-By: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Link: https://patch.msgid.link/20241104163203.435515-5-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: vector: Fix NAPI budget handling</title>
<updated>2024-09-12T18:09:41+00:00</updated>
<author>
<name>Anton Ivanov</name>
<email>anton.ivanov@cambridgegreys.com</email>
</author>
<published>2024-07-06T09:12:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=671cd5eed9db3415b42826747114a330bc303ae9'/>
<id>671cd5eed9db3415b42826747114a330bc303ae9</id>
<content type='text'>
Fix the handling of NAPI budget.

Signed-off-by: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix the handling of NAPI budget.

Signed-off-by: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: vector: Replace locks guarding queue depth with atomics</title>
<updated>2024-09-12T17:56:05+00:00</updated>
<author>
<name>Anton Ivanov</name>
<email>anton.ivanov@cambridgegreys.com</email>
</author>
<published>2024-07-05T10:53:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=612a8c8e0b43ba7e3d0e51f6f76a5fec4912d439'/>
<id>612a8c8e0b43ba7e3d0e51f6f76a5fec4912d439</id>
<content type='text'>
UML vector drivers use ring buffer structures which map
preallocated skbs onto mmsg vectors for use with sendmmsg
and recvmmsg. They are designed around a single consumer,
single producer pattern allowing simultaneous enqueue and
dequeue.

Lock debugging with preemption showed possible races when
locking the queue depth. This patch addresses this by
removing extra locks, adding barriers and making queue
depth inc/dec and access atomic.

Signed-off-by: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
UML vector drivers use ring buffer structures which map
preallocated skbs onto mmsg vectors for use with sendmmsg
and recvmmsg. They are designed around a single consumer,
single producer pattern allowing simultaneous enqueue and
dequeue.

Lock debugging with preemption showed possible races when
locking the queue depth. This patch addresses this by
removing extra locks, adding barriers and making queue
depth inc/dec and access atomic.

Signed-off-by: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: vector: always reset vp-&gt;opened</title>
<updated>2024-07-04T10:03:26+00:00</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2024-07-03T16:46:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=98ff534ec2cd02496c166614e6c1391d8e092e51'/>
<id>98ff534ec2cd02496c166614e6c1391d8e092e51</id>
<content type='text'>
If open fails, we have already set vp-&gt;opened, but it's
not reset so that any further attempts will just return
-ENXIO. Reset vp-&gt;opened even if close has nothing to do.

This helps e.g. with slirp4netns handling only a single
connection, you can then restart it and open the device
again.

Link: https://patch.msgid.link/20240703184622.df40c5c38461.Id4e20b48938c6019d99e6133227a34ac059db466@changeid
Acked-By: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If open fails, we have already set vp-&gt;opened, but it's
not reset so that any further attempts will just return
-ENXIO. Reset vp-&gt;opened even if close has nothing to do.

This helps e.g. with slirp4netns handling only a single
connection, you can then restart it and open the device
again.

Link: https://patch.msgid.link/20240703184622.df40c5c38461.Id4e20b48938c6019d99e6133227a34ac059db466@changeid
Acked-By: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: vector: remove vp-&gt;lock</title>
<updated>2024-07-04T10:03:23+00:00</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2024-07-03T16:46:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a0470a9f699a847e519293db9e33a4dae169467d'/>
<id>a0470a9f699a847e519293db9e33a4dae169467d</id>
<content type='text'>
This lock is useless, all the places that are using
it for some locking will already hold the RTNL. Just
remove it.

Link: https://patch.msgid.link/20240703184606.19aa35b14959.I9cf5f2c4e35abd06cc89bf2e990fa755eb8e5f0f@changeid
Acked-By: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This lock is useless, all the places that are using
it for some locking will already hold the RTNL. Just
remove it.

Link: https://patch.msgid.link/20240703184606.19aa35b14959.I9cf5f2c4e35abd06cc89bf2e990fa755eb8e5f0f@changeid
Acked-By: Anton Ivanov &lt;anton.ivanov@cambridgegreys.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: vector: remove unused len variable/calculation</title>
<updated>2024-04-22T20:29:31+00:00</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2024-03-28T09:06:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2caa4982ea8ba601faf8313097720f87aafa7ea5'/>
<id>2caa4982ea8ba601faf8313097720f87aafa7ea5</id>
<content type='text'>
The len variable is unused, so not needed, remove it.

Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Reviewed-by: Tiwei Bie &lt;tiwei.btw@antgroup.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The len variable is unused, so not needed, remove it.

Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Reviewed-by: Tiwei Bie &lt;tiwei.btw@antgroup.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: vector: fix bpfflash parameter evaluation</title>
<updated>2024-04-22T20:28:40+00:00</updated>
<author>
<name>Johannes Berg</name>
<email>johannes.berg@intel.com</email>
</author>
<published>2024-03-28T09:06:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=584ed2f76ff5fe360d87a04d17b6520c7999e06b'/>
<id>584ed2f76ff5fe360d87a04d17b6520c7999e06b</id>
<content type='text'>
With W=1 the build complains about a pointer compared to
zero, clearly the result should've been compared.

Fixes: 9807019a62dc ("um: Loadable BPF "Firmware" for vector drivers")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Reviewed-by: Tiwei Bie &lt;tiwei.btw@antgroup.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With W=1 the build complains about a pointer compared to
zero, clearly the result should've been compared.

Fixes: 9807019a62dc ("um: Loadable BPF "Firmware" for vector drivers")
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
Reviewed-by: Tiwei Bie &lt;tiwei.btw@antgroup.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: Convert strscpy() usage to 2-argument style</title>
<updated>2024-02-21T04:47:32+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2024-02-02T11:55:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=1e06589843632afc78d2f8e9735dac3146b97988'/>
<id>1e06589843632afc78d2f8e9735dac3146b97988</id>
<content type='text'>
The ARCH=um build has its own idea about strscpy()'s definition. Adjust
the callers to remove the redundant sizeof() arguments ahead of treewide
changes, since it needs a manual adjustment for the newly named
sized_strscpy() export.

Cc: Richard Weinberger &lt;richard@nod.at&gt;
Cc: linux-um@lists.infradead.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The ARCH=um build has its own idea about strscpy()'s definition. Adjust
the callers to remove the redundant sizeof() arguments ahead of treewide
changes, since it needs a manual adjustment for the newly named
sized_strscpy() export.

Cc: Richard Weinberger &lt;richard@nod.at&gt;
Cc: linux-um@lists.infradead.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: vector: Fix memory leak in vector_config</title>
<updated>2023-02-01T21:11:27+00:00</updated>
<author>
<name>Xiang Yang</name>
<email>xiangyang3@huawei.com</email>
</author>
<published>2022-11-15T07:32:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=8f88c73afe481f93d40801596927e8c0047b6d96'/>
<id>8f88c73afe481f93d40801596927e8c0047b6d96</id>
<content type='text'>
If the return value of the uml_parse_vector_ifspec function is NULL,
we should call kfree(params) to prevent memory leak.

Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
Signed-off-by: Xiang Yang &lt;xiangyang3@huawei.com&gt;
Acked-By: Anton Ivanov &lt;anton.ivanov@kot-begemot.co.uk&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the return value of the uml_parse_vector_ifspec function is NULL,
we should call kfree(params) to prevent memory leak.

Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
Signed-off-by: Xiang Yang &lt;xiangyang3@huawei.com&gt;
Acked-By: Anton Ivanov &lt;anton.ivanov@kot-begemot.co.uk&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>um: move from strlcpy with unused retval to strscpy</title>
<updated>2022-09-19T20:45:24+00:00</updated>
<author>
<name>Wolfram Sang</name>
<email>wsa+renesas@sang-engineering.com</email>
</author>
<published>2022-08-18T20:59:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=e6e4d33f380fbfd85b909d16c9b639299e5c37a6'/>
<id>e6e4d33f380fbfd85b909d16c9b639299e5c37a6</id>
<content type='text'>
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
</pre>
</div>
</content>
</entry>
</feed>
