<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/rpmsg, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family</title>
<updated>2026-11-06T05:55:50+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees+treewide@kernel.org</email>
</author>
<published>2026-10-29T06:16:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4dd10fbbeb9c33709edc89916e19c03c780a0751'/>
<id>4dd10fbbeb9c33709edc89916e19c03c780a0751</id>
<content type='text'>
Mirroring the earlier kmalloc_obj() conversion, convert the
device-managed allocators over to the type-based API using the now
updated scripts/coccinelle/api/kmalloc_objs.cocci. The size is derived
from the type rather than written out as a sizeof(), and the result is
a pointer to that type rather than void *, so a mismatch between the
size requested and the variable assigned becomes a build error instead
of being silently accepted.

The conversions break down as:

	6713	devm_kzalloc_obj()
	1749	devm_kzalloc_objs()
	 307	devm_kzalloc_flex()
	  91	devm_kmalloc_objs()
	  82	devm_kmalloc_obj()
	   2	devm_kmalloc_flex()

The rules deliberately leave alone allocations sized by a string or a
byte-sized type, or assigned to a pointer to a byte-sized type, since
those are byte buffers rather than objects. Allocations sized by a
multi-byte integer type are only converted when they are assigned to a
pointer to that same type, and allocations of pointers to integers or of
void pointers are left alone too. After this change, 528 files still
call devm_kmalloc(), devm_kzalloc(), devm_kcalloc(), or
devm_kmalloc_array().

Build tested with allmodconfig on x86_64, arm64, i386, arm, riscv, s390,
m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC
16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mirroring the earlier kmalloc_obj() conversion, convert the
device-managed allocators over to the type-based API using the now
updated scripts/coccinelle/api/kmalloc_objs.cocci. The size is derived
from the type rather than written out as a sizeof(), and the result is
a pointer to that type rather than void *, so a mismatch between the
size requested and the variable assigned becomes a build error instead
of being silently accepted.

The conversions break down as:

	6713	devm_kzalloc_obj()
	1749	devm_kzalloc_objs()
	 307	devm_kzalloc_flex()
	  91	devm_kmalloc_objs()
	  82	devm_kmalloc_obj()
	   2	devm_kmalloc_flex()

The rules deliberately leave alone allocations sized by a string or a
byte-sized type, or assigned to a pointer to a byte-sized type, since
those are byte buffers rather than objects. Allocations sized by a
multi-byte integer type are only converted when they are assigned to a
pointer to that same type, and allocations of pointers to integers or of
void pointers are left alone too. After this change, 528 files still
call devm_kmalloc(), devm_kzalloc(), devm_kcalloc(), or
devm_kmalloc_array().

Build tested with allmodconfig on x86_64, arm64, i386, arm, riscv, s390,
m68k, mips, parisc, sparc, loongarch, arc, xtensa, and openrisc with GCC
16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: virtio: fix error handling in TX buffer wait</title>
<updated>2026-10-14T15:45:47+00:00</updated>
<author>
<name>Atul Akella</name>
<email>atul.akella@gmail.com</email>
</author>
<published>2026-10-13T16:00:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=7dd4cffdf4c2a496ccf783303a03d687a2127baf'/>
<id>7dd4cffdf4c2a496ccf783303a03d687a2127baf</id>
<content type='text'>
The TX buffer wait loop in rpmsg_send_offchannel_raw() ignores the
possibility of wait_event_interruptible_timeout() returning a
negative value, which happens when the wait is interrupted by a
signal. In that case the loop spins back around and re-arms the
wait instead of propagating the signal, which can stall a task
that is trying to be killed.

Separately, on a genuine timeout (return value 0) the function
returns -ERESTARTSYS, which is reserved for signal-interrupted
syscalls that the kernel may restart. A timeout is not a signal
and should not be treated as restartable; return -ETIMEDOUT
instead.

Handle both cases explicitly: return err directly when negative,
and return -ETIMEDOUT on timeout.

Fixes: bcabbccabffe ("rpmsg: add virtio-based remote processor messaging bus")
Signed-off-by: Atul Akella &lt;atul.akella@gmail.com&gt;
Link: https://lore.kernel.org/r/20261013160055.1362-1-atul.akella@gmail.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The TX buffer wait loop in rpmsg_send_offchannel_raw() ignores the
possibility of wait_event_interruptible_timeout() returning a
negative value, which happens when the wait is interrupted by a
signal. In that case the loop spins back around and re-arms the
wait instead of propagating the signal, which can stall a task
that is trying to be killed.

Separately, on a genuine timeout (return value 0) the function
returns -ERESTARTSYS, which is reserved for signal-interrupted
syscalls that the kernel may restart. A timeout is not a signal
and should not be treated as restartable; return -ETIMEDOUT
instead.

Handle both cases explicitly: return err directly when negative,
and return -ETIMEDOUT on timeout.

Fixes: bcabbccabffe ("rpmsg: add virtio-based remote processor messaging bus")
Signed-off-by: Atul Akella &lt;atul.akella@gmail.com&gt;
Link: https://lore.kernel.org/r/20261013160055.1362-1-atul.akella@gmail.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: mtk: release channel OF node on device teardown</title>
<updated>2026-10-14T15:37:03+00:00</updated>
<author>
<name>Avi Weiss</name>
<email>thnkslprpt@gmail.com</email>
</author>
<published>2026-10-13T07:47:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=00e100cfbf7bc159e462df16832cddeaf2cab770'/>
<id>00e100cfbf7bc159e462df16832cddeaf2cab770</id>
<content type='text'>
mtk_rpmsg_match_device_subnode() returns a referenced OF child
node, which is stored in rpdev-&gt;dev.of_node.

mtk_rpmsg_release_device() later frees the containing allocation
without dropping that ref.

Release the OF node when the RPMsg device is destroyed.

Fixes: 7017996951fd ("rpmsg: add rpmsg support for mt8183 SCP.")
Signed-off-by: Avi Weiss &lt;thnkslprpt@gmail.com&gt;
Link: https://lore.kernel.org/r/20261013074744.942560-1-thnkslprpt@gmail.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
mtk_rpmsg_match_device_subnode() returns a referenced OF child
node, which is stored in rpdev-&gt;dev.of_node.

mtk_rpmsg_release_device() later frees the containing allocation
without dropping that ref.

Release the OF node when the RPMsg device is destroyed.

Fixes: 7017996951fd ("rpmsg: add rpmsg support for mt8183 SCP.")
Signed-off-by: Avi Weiss &lt;thnkslprpt@gmail.com&gt;
Link: https://lore.kernel.org/r/20261013074744.942560-1-thnkslprpt@gmail.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: virtio_rpmsg_bus: Get buffer size from config space</title>
<updated>2026-09-04T20:13:09+00:00</updated>
<author>
<name>Tanmay Shah</name>
<email>tanmay.shah@amd.com</email>
</author>
<published>2026-08-28T14:58:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ca96ea25e51aeae45b0c947feb432fc74e2d1928'/>
<id>ca96ea25e51aeae45b0c947feb432fc74e2d1928</id>
<content type='text'>
512 bytes isn't always suitable for all the cases, let firmware
maker decide the best value from the resource table. Enabled
by VIRTIO_RPMSG_F_BUFSZ feature bit.

Signed-off-by: Tanmay Shah &lt;tanmay.shah@amd.com&gt;
Acked-by: Arnaud Pouliquen &lt;arnaud.pouliquen@foss.st.com&gt;
Link: https://lore.kernel.org/r/20260828145853.2843486-4-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
512 bytes isn't always suitable for all the cases, let firmware
maker decide the best value from the resource table. Enabled
by VIRTIO_RPMSG_F_BUFSZ feature bit.

Signed-off-by: Tanmay Shah &lt;tanmay.shah@amd.com&gt;
Acked-by: Arnaud Pouliquen &lt;arnaud.pouliquen@foss.st.com&gt;
Link: https://lore.kernel.org/r/20260828145853.2843486-4-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: virtio_rpmsg_bus: Allow different size of tx and rx bufs</title>
<updated>2026-09-04T19:27:55+00:00</updated>
<author>
<name>Tanmay Shah</name>
<email>tanmay.shah@amd.com</email>
</author>
<published>2026-08-28T14:58:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8727c3f3e24143a21c231bf64a375c44b949bdb0'/>
<id>8727c3f3e24143a21c231bf64a375c44b949bdb0</id>
<content type='text'>
Current design allocates memory for tx and rx buffers equally. The
throughput can be increased if the user is allowed to configure number
of tx and rx buffers as required. Hence, do not split number of tx &amp; rx
buffers into half, but decide based on respective vring size.

Signed-off-by: Tanmay Shah &lt;tanmay.shah@amd.com&gt;
Acked-by: Arnaud Pouliquen &lt;arnaud.pouliquen@foss.st.com&gt;
Link: https://lore.kernel.org/r/20260828145853.2843486-3-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Current design allocates memory for tx and rx buffers equally. The
throughput can be increased if the user is allowed to configure number
of tx and rx buffers as required. Hence, do not split number of tx &amp; rx
buffers into half, but decide based on respective vring size.

Signed-off-by: Tanmay Shah &lt;tanmay.shah@amd.com&gt;
Acked-by: Arnaud Pouliquen &lt;arnaud.pouliquen@foss.st.com&gt;
Link: https://lore.kernel.org/r/20260828145853.2843486-3-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: virtio_rpmsg_bus: Rename rbufs and sbufs</title>
<updated>2026-09-04T19:27:23+00:00</updated>
<author>
<name>Tanmay Shah</name>
<email>tanmay.shah@amd.com</email>
</author>
<published>2026-08-28T14:58:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=92619efc9285df5720221c5650139c332cdf228c'/>
<id>92619efc9285df5720221c5650139c332cdf228c</id>
<content type='text'>
rename variables with clear names.
%s/rbufs/rx_bufs/
%s/sbufs/tx_bufs/
%s/last_sbuf/last_tx_buf/

Signed-off-by: Tanmay Shah &lt;tanmay.shah@amd.com&gt;
Acked-by: Arnaud Pouliquen &lt;arnaud.pouliquen@foss.st.com&gt;
Link: https://lore.kernel.org/r/20260828145853.2843486-2-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rename variables with clear names.
%s/rbufs/rx_bufs/
%s/sbufs/tx_bufs/
%s/last_sbuf/last_tx_buf/

Signed-off-by: Tanmay Shah &lt;tanmay.shah@amd.com&gt;
Acked-by: Arnaud Pouliquen &lt;arnaud.pouliquen@foss.st.com&gt;
Link: https://lore.kernel.org/r/20260828145853.2843486-2-tanmay.shah@amd.com
Signed-off-by: Mathieu Poirier &lt;mathieu.poirier@linaro.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: glink: smem: order FIFO read after availability check</title>
<updated>2026-07-14T03:11:52+00:00</updated>
<author>
<name>Chunkai Deng</name>
<email>chunkai.deng@oss.qualcomm.com</email>
</author>
<published>2026-06-18T07:16:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=786439ad58763e04b91bc2ec5f590e463939f197'/>
<id>786439ad58763e04b91bc2ec5f590e463939f197</id>
<content type='text'>
glink_smem_rx_peek() reads the RX FIFO payload after the caller has
determined data is available via glink_smem_rx_avail(), which reads the
remote-updated head index. A control dependency between the head read
and the subsequent payload read does not order the two loads, so the
CPU may speculatively read the FIFO before observing the head update
and consume stale data the remote has not yet published.

Add rmb() in glink_smem_rx_peek() before the memcpy_fromio() so the
availability (head) read is ordered ahead of the FIFO payload read,
matching the consumer pattern in
Documentation/core-api/circular-buffers.rst.

Fixes: caf989c350e8 ("rpmsg: glink: Introduce glink smem based transport")
Cc: stable@vger.kernel.org
Signed-off-by: Chunkai Deng &lt;chunkai.deng@oss.qualcomm.com&gt;
Reviewed-by: Konrad Dybcio &lt;konrad.dybcio@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20260618-rpmsg-glink-smem-mb-v1-1-68a026453a69@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
glink_smem_rx_peek() reads the RX FIFO payload after the caller has
determined data is available via glink_smem_rx_avail(), which reads the
remote-updated head index. A control dependency between the head read
and the subsequent payload read does not order the two loads, so the
CPU may speculatively read the FIFO before observing the head update
and consume stale data the remote has not yet published.

Add rmb() in glink_smem_rx_peek() before the memcpy_fromio() so the
availability (head) read is ordered ahead of the FIFO payload read,
matching the consumer pattern in
Documentation/core-api/circular-buffers.rst.

Fixes: caf989c350e8 ("rpmsg: glink: Introduce glink smem based transport")
Cc: stable@vger.kernel.org
Signed-off-by: Chunkai Deng &lt;chunkai.deng@oss.qualcomm.com&gt;
Reviewed-by: Konrad Dybcio &lt;konrad.dybcio@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20260618-rpmsg-glink-smem-mb-v1-1-68a026453a69@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: glink: fix deadlock in endpoint destroy during driver detach</title>
<updated>2026-07-14T02:55:29+00:00</updated>
<author>
<name>Vishnu Santhosh</name>
<email>vishnu.santhosh@oss.qualcomm.com</email>
</author>
<published>2026-06-04T08:42:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5a5a48e788e02fd8a8eb7188ce440572d6c12418'/>
<id>5a5a48e788e02fd8a8eb7188ce440572d6c12418</id>
<content type='text'>
During driver detach, the device core holds the device mutex throughout
the driver's remove callback chain.  When the rpmsg endpoint is
destroyed as part of that teardown, the GLINK endpoint destroy
implementation attempts to unregister the underlying rpmsg device.
That unregistration calls device_del(), which tries to re-acquire the
same device mutex already held higher up the stack, causing rmmod to
hang indefinitely.

The deadlock manifests with the following call chain:

[&lt;0&gt;] device_del+0x44/0x414  &lt;- tries to acquire same mutex
[&lt;0&gt;] device_unregister+0x18/0x34
[&lt;0&gt;] rpmsg_unregister_device+0x28/0x4c
[&lt;0&gt;] qcom_glink_remove_rpmsg_device+0x70/0xc0
[&lt;0&gt;] qcom_glink_destroy_ept+0x58/0xbc
[&lt;0&gt;] rpmsg_dev_remove+0x50/0x60
[&lt;0&gt;] device_remove+0x4c/0x80
[&lt;0&gt;] device_release_driver_internal+0x1cc/0x228  &lt;- acquires device mutex
[&lt;0&gt;] driver_detach+0x4c/0x98
[&lt;0&gt;] bus_remove_driver+0x6c/0xbc
[&lt;0&gt;] driver_unregister+0x30/0x60
[&lt;0&gt;] unregister_rpmsg_driver+0x10/0x1c
[&lt;0&gt;] fastrpc_exit+0x28/0x38 [fastrpc]
[&lt;0&gt;] __arm64_sys_delete_module+0x1b8/0x294
[&lt;0&gt;] invoke_syscall+0x48/0x10c
[&lt;0&gt;] el0_svc_common.constprop.0+0xc0/0xe0
[&lt;0&gt;] do_el0_svc+0x1c/0x28
[&lt;0&gt;] el0_svc+0x34/0x108
[&lt;0&gt;] el0t_64_sync_handler+0xa0/0xe4
[&lt;0&gt;] el0t_64_sync+0x198/0x19c

The rpmsg device unregistration inside endpoint destroy is redundant.
In both contexts where endpoint destruction is triggered:

- Driver detach path: the driver core already tears down the rpmsg
  device.

- Channel close path: the rpmsg device is already unregistered before
  endpoint destruction is reached.

Remove the redundant unregistration to fix the deadlock.

Co-developed-by: Deepak Kumar Singh &lt;deepak.singh@oss.qualcomm.com&gt;
Signed-off-by: Deepak Kumar Singh &lt;deepak.singh@oss.qualcomm.com&gt;
Signed-off-by: Vishnu Santhosh &lt;vishnu.santhosh@oss.qualcomm.com&gt;
Tested-by: Bjorn Andersson &lt;bjorn.andersson@oss.qualcomm.com&gt;
Fixes: a53e356df548 ("rpmsg: glink: fix rpmsg device leak")
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20260604-rpmsg-glink-fix-deadlock-destroy-ept-v1-1-b8a54ad1e4fd@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
During driver detach, the device core holds the device mutex throughout
the driver's remove callback chain.  When the rpmsg endpoint is
destroyed as part of that teardown, the GLINK endpoint destroy
implementation attempts to unregister the underlying rpmsg device.
That unregistration calls device_del(), which tries to re-acquire the
same device mutex already held higher up the stack, causing rmmod to
hang indefinitely.

The deadlock manifests with the following call chain:

[&lt;0&gt;] device_del+0x44/0x414  &lt;- tries to acquire same mutex
[&lt;0&gt;] device_unregister+0x18/0x34
[&lt;0&gt;] rpmsg_unregister_device+0x28/0x4c
[&lt;0&gt;] qcom_glink_remove_rpmsg_device+0x70/0xc0
[&lt;0&gt;] qcom_glink_destroy_ept+0x58/0xbc
[&lt;0&gt;] rpmsg_dev_remove+0x50/0x60
[&lt;0&gt;] device_remove+0x4c/0x80
[&lt;0&gt;] device_release_driver_internal+0x1cc/0x228  &lt;- acquires device mutex
[&lt;0&gt;] driver_detach+0x4c/0x98
[&lt;0&gt;] bus_remove_driver+0x6c/0xbc
[&lt;0&gt;] driver_unregister+0x30/0x60
[&lt;0&gt;] unregister_rpmsg_driver+0x10/0x1c
[&lt;0&gt;] fastrpc_exit+0x28/0x38 [fastrpc]
[&lt;0&gt;] __arm64_sys_delete_module+0x1b8/0x294
[&lt;0&gt;] invoke_syscall+0x48/0x10c
[&lt;0&gt;] el0_svc_common.constprop.0+0xc0/0xe0
[&lt;0&gt;] do_el0_svc+0x1c/0x28
[&lt;0&gt;] el0_svc+0x34/0x108
[&lt;0&gt;] el0t_64_sync_handler+0xa0/0xe4
[&lt;0&gt;] el0t_64_sync+0x198/0x19c

The rpmsg device unregistration inside endpoint destroy is redundant.
In both contexts where endpoint destruction is triggered:

- Driver detach path: the driver core already tears down the rpmsg
  device.

- Channel close path: the rpmsg device is already unregistered before
  endpoint destruction is reached.

Remove the redundant unregistration to fix the deadlock.

Co-developed-by: Deepak Kumar Singh &lt;deepak.singh@oss.qualcomm.com&gt;
Signed-off-by: Deepak Kumar Singh &lt;deepak.singh@oss.qualcomm.com&gt;
Signed-off-by: Vishnu Santhosh &lt;vishnu.santhosh@oss.qualcomm.com&gt;
Tested-by: Bjorn Andersson &lt;bjorn.andersson@oss.qualcomm.com&gt;
Fixes: a53e356df548 ("rpmsg: glink: fix rpmsg device leak")
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20260604-rpmsg-glink-fix-deadlock-destroy-ept-v1-1-b8a54ad1e4fd@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: char: Check for ongoing chrdev destroy</title>
<updated>2026-07-09T20:11:17+00:00</updated>
<author>
<name>Chris Lew</name>
<email>christopher.lew@oss.qualcomm.com</email>
</author>
<published>2026-04-06T04:29:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1f9c2897afb0fe86c1fdf4f5e23c5fb8f7442f6d'/>
<id>1f9c2897afb0fe86c1fdf4f5e23c5fb8f7442f6d</id>
<content type='text'>
A null pointer panic is observed when stopping a remoteproc and closing
a character device using the RPMSG_DESTROY_EPT_IOCTL. There is a race
where each context calls rpmsg_chrdev_eptdev_destroy(). The thread that
runs second will call cdev_device_del() for a second time, which fails
because the first call already removed the device from sysfs. Add a
check at the beginning of destroy and exit early if the destroy call
has already been done.

[ 26.654130] Call trace
[ 26.656658] kernfs_find_and_get_ns+0x28/0x8
[ 26.661140] sysfs_unmerge_group+0x2c/0x7
[ 26.665357] dpm_sysfs_remove+0x38/0x8
[ 26.669305] device_del+0xa4/0x3e
[ 26.672811] cdev_device_del+0x28/0x7
[ 26.676675] rpmsg_chrdev_eptdev_destroy+0x68/0x98
[ 26.682765] rpmsg_eptdev_ioctl+0x130/0x11c8
[ 26.688318] __arm64_sys_ioctl+0xb4/0x10
[ 26.692448] invoke_syscall+0x50/0x12
[ 26.696312] el0_svc_common.constprop.0+0xc8/0xf
[ 26.701151] do_el0_svc+0x24/0x3
[ 26.704570] el0_svc+0x40/0x17
[ 26.707810] el0t_64_sync_handler+0x120/0x13
[ 26.712288] el0t_64_sync+0x1a0/0x1a

Signed-off-by: Chris Lew &lt;christopher.lew@oss.qualcomm.com&gt;
Signed-off-by: Vishnu Santhosh &lt;vishnu.santhosh@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20260406-rpmsg-char-fix-chrdev-destroy-race-v1-1-7317434fa246@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A null pointer panic is observed when stopping a remoteproc and closing
a character device using the RPMSG_DESTROY_EPT_IOCTL. There is a race
where each context calls rpmsg_chrdev_eptdev_destroy(). The thread that
runs second will call cdev_device_del() for a second time, which fails
because the first call already removed the device from sysfs. Add a
check at the beginning of destroy and exit early if the destroy call
has already been done.

[ 26.654130] Call trace
[ 26.656658] kernfs_find_and_get_ns+0x28/0x8
[ 26.661140] sysfs_unmerge_group+0x2c/0x7
[ 26.665357] dpm_sysfs_remove+0x38/0x8
[ 26.669305] device_del+0xa4/0x3e
[ 26.672811] cdev_device_del+0x28/0x7
[ 26.676675] rpmsg_chrdev_eptdev_destroy+0x68/0x98
[ 26.682765] rpmsg_eptdev_ioctl+0x130/0x11c8
[ 26.688318] __arm64_sys_ioctl+0xb4/0x10
[ 26.692448] invoke_syscall+0x50/0x12
[ 26.696312] el0_svc_common.constprop.0+0xc8/0xf
[ 26.701151] do_el0_svc+0x24/0x3
[ 26.704570] el0_svc+0x40/0x17
[ 26.707810] el0t_64_sync_handler+0x120/0x13
[ 26.712288] el0t_64_sync+0x1a0/0x1a

Signed-off-by: Chris Lew &lt;christopher.lew@oss.qualcomm.com&gt;
Signed-off-by: Vishnu Santhosh &lt;vishnu.santhosh@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20260406-rpmsg-char-fix-chrdev-destroy-race-v1-1-7317434fa246@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rpmsg: glink: Replace strcpy() with strscpy()</title>
<updated>2026-07-09T19:46:45+00:00</updated>
<author>
<name>Sudeepgoud Patil</name>
<email>quic_sudeepgo@quicinc.com</email>
</author>
<published>2025-12-11T08:48:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ad6d7795388dbfc8a4c8980b49ad43648b1d6efe'/>
<id>ad6d7795388dbfc8a4c8980b49ad43648b1d6efe</id>
<content type='text'>
Replace strcpy() with the safer strscpy() to address unsafe API
usage warnings[1] from static analysis tools, as strcpy() performs
no bounds checking on the destination buffer.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy

Signed-off-by: Sudeepgoud Patil &lt;quic_sudeepgo@quicinc.com&gt;
Signed-off-by: Vishnu Santhosh &lt;vishnu.santhosh@oss.qualcomm.com&gt;
Reviewed-by: Chris Lew &lt;christopher.lew@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20251211-rpmsg-glink-strcpy-replace-v1-1-be06308e5724@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace strcpy() with the safer strscpy() to address unsafe API
usage warnings[1] from static analysis tools, as strcpy() performs
no bounds checking on the destination buffer.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy

Signed-off-by: Sudeepgoud Patil &lt;quic_sudeepgo@quicinc.com&gt;
Signed-off-by: Vishnu Santhosh &lt;vishnu.santhosh@oss.qualcomm.com&gt;
Reviewed-by: Chris Lew &lt;christopher.lew@oss.qualcomm.com&gt;
Link: https://lore.kernel.org/r/20251211-rpmsg-glink-strcpy-replace-v1-1-be06308e5724@oss.qualcomm.com
Signed-off-by: Bjorn Andersson &lt;andersson@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
