Commit graph zephyr/subsys
Author SHA1 Message Date
Seppo Takalo
eecb164fad modem: cmux: Prevent sending to DLC pipes before CMUX is open
If CMUX is not yet connected, or is doing a disconnection,
we should not accept any traffic into pipes.

Block the traffic by replacing the !cmux->attached test with
a runtime test is_connected() that compare states as well.

Rename previous is_connected() to is_active() as it was used
on runtime power management checks.

One exception to rule is pipe->open(), which should be allowed
to be called same time as CMUX connection is initiated.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2026-04-16 14:44:17 +02:00
Seppo Takalo
662f83809a modem: cmux: Close pipes on CMUX close
When the CMUX control channel is closed, CMUX is shut down and
all pipes should be in closed state too.
Notify all modules of this by calling modem_cmux_dlci_pipes_release()
when disconnecting.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2026-04-16 14:44:17 +02:00
Krzysztof Chruściński
59da64a664 debug: coresight: cs_trace_defmt: Fix uninitialized variable warning
In certain configurations there could be a warning due to potential
use of uninitialized variable. Add initialization.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-04-15 17:17:01 -04:00
Tim Pambor
aaed8332a6 net: ipv6: nbr: fix use-after-free
Avoid accessing the packet after sending it, as the driver may
have already unreferenced or freed it. Use iface argument instead
of calling net_pkt_iface() on a potentially freed packet when
updating packet statistics.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-04-15 17:16:36 -04:00
Tim Pambor
3159c53e8e net: ipv6: mld: fix use-after-free
Avoid accessing the packet after sending it, as the driver may
have already unreferenced or freed it. Store the iface before
sending instead of calling net_pkt_iface() on a potentially
freed packet when updating packet statistics.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-04-15 17:16:36 -04:00
Tim Pambor
0223e5e3ec net: ip: igmp: fix use-after-free
Avoid accessing the packet after sending it, as the driver may
have already unreferenced or freed it. Store the iface before
sending instead of calling net_pkt_iface() on a potentially
freed packet when updating packet statistics.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-04-15 17:16:36 -04:00
Tim Pambor
09c8578c66 net: ip: icmpv6: fix use-after-free
Avoid accessing the packet after sending it, as the driver may
have already unreferenced or freed it. Store the iface before
sending instead of calling net_pkt_iface() on a potentially
freed packet when updating packet statistics.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-04-15 17:16:36 -04:00
Tim Pambor
86e21665d4 net: ip: icmpv4: fix use-after-free
Avoid accessing the packet after sending it, as the driver may
have already unreferenced or freed it. Store the iface before
sending instead of calling net_pkt_iface() on a potentially
freed packet when updating packet statistics.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2026-04-15 17:16:36 -04:00
Jamie McCrae
f99dbd622e mgmt: mcumgr: grp: fs_mgmt: Fix not checking if write completed
Fixes an issue whereby a write might have partially been successful
but failed due to insufficient space in the storage device by
re-attempting the write again with the offset, and if it still
fails, return an error

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2026-04-15 17:16:25 -04:00
Emil Gydesen
cce6230e29 Bluetooth: BAP: Fix deligator typo
It is called the BAP Scan Delegator, and not deligator.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-04-15 17:16:13 -04:00
Alex Ciascai
03ccc9b24d bluetooth: BASS: Reject Remove Source when PA is syncing or synced
If a Remove Source request is received while the IUT is in PA sync
states INFO_REQ or SYNCED, the request is rejected and the source
is not removed.

Signed-off-by: Alex Ciascai <alexandru.ciascai@nordicsemi.no>
2026-04-15 17:16:03 -04:00
Peter van der Perk
a833ec7074 rtio: add selectable placement for SQE and block pool
Add Kconfig options to control where RTIO SQEs and the RTIO block pool
are allocated: default RAM, DTCM, or a Zephyr nocache region.

This improves robustness and performance for DMA-heavy RTIO users:
- Avoids D-cache coherency pitfalls (especially with tiny DMA buffers).
- Enables using DTCM for lower-latency RTIO queue and pool access.

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-04-15 17:15:55 -04:00
Hanliang Xu
7aab6c07f3 Bluetooth: TBS: fix URI scheme list matching
Comparisons only triggered on comma, leaving the last entry unchecked,
and start_idx was never advanced after each delimiter, making all
subsequent length calculations wrong.

Fix by updating start_idx and uri_scheme_cand on each comma, then
adding a post-loop check for the final entry.

Fixes #105073

Signed-off-by: Hanliang Xu <leonxu2004@outlook.com>
2026-04-15 17:15:16 -04:00
Alberto Escolar Piedras
4f2e63556a net: coap: mark function as possibly unused
encode_be32() is only used in some configurations.
Let's mark it as possibly unused so the compiler does not warn us about
it

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-04-15 15:39:01 +02:00
Benjamin Cabé
700c42c4aa net: coap: remove unused insert_be32 function
Commit b9d3344fd4 introduced this static
helper function that is effectively unused and makes clang unhappy.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-04-15 13:50:00 +02:00
Syed Syed
edcfe755ae logging: fix unaligned access in z_log_msg_enqueue
On architectures with strict alignment (RISC-V, ARM Cortex-M0),
multi-domain logging can trigger a Load/Store Address Misaligned
exception. This occurs when z_log_msg_enqueue receives a data
pointer from an IPC transport that is not word-aligned.

This commit reorders the operations to perform the memcpy into
the aligned internal buffer before accessing any struct members.

Signed-off-by: Syed Syed <syeds@amd.com>
2026-04-15 05:56:11 -04:00
Lyle Zhu
e94f98edd9 bluetooth: host: rfcomm: adjust MTU for credit-based flow control
When credit-based flow control (CFC) is supported, reduce the MTU by
one byte to account for the credits field in RFCOMM frames. This
prevents the SDU length from exceeding the maximum frame size when
the credits field is included in the frame.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-04-15 05:49:22 -04:00
Lyle Zhu
e52fcdc7ea bluetooth: host: rfcomm: use generic CRC8 implementation
Replace custom RFCOMM CRC table and calculation with the generic CRC8
implementation from zephyr/sys/crc.h. This reduces code duplication and
improves maintainability. Also, it will reduce the flash footprint by
about 300 bytes.

The RFCOMM FCS calculation uses CRC-8 with polynomial 0x07, reflected
input/output, and initial value 0xff, which matches the definition of
the specification GSM 07.10.

Also simplify rfcomm_check_fcs() to reuse rfcomm_calc_fcs() and compare
the calculated FCS with the received value directly. It is consistent
with the following  logic:
o Calculate the CRC,
o CRC = crctable[CRC^"received FCS"],
o if the CRC equals to 0xcf.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-04-15 05:49:14 -04:00
Yuheng Li
02a3299bea Bluetooth: Classic: HFP: HF: fix 3-way call direction flag update
Use atomic_set_bit() instead of atomic_test_bit() in
set_call_incoming_flag().

atomic_test_bit() is read-only, so the previous code did not update
INCOMING_3WAY/OUTGOING_3WAY flags when call_count > 1.

Signed-off-by: Yuheng Li <liyuheng@xiaomi.com>
2026-04-15 05:49:05 -04:00
Rithic Chellaram Hariharan
1fcdeffa95 net: sockets: tls: make session cache prefix configurable
Turn the hardcoded TLS_SETTINGS_PREFIX into a Kconfig symbol
CONFIG_NET_SOCKETS_TLS_SESSION_CACHE_PERSISTENT_PREFIX so users
can choose a different settings key prefix if needed.

Signed-off-by: Rithic Chellaram Hariharan <gr8rithic@gmail.com>
2026-04-15 05:48:42 -04:00
Rithic Chellaram Hariharan
93eb99a2e4 net: sockets: tls: add persistent session cache via settings
Add persistent TLS/DTLS session cache support using the settings
subsystem. Sessions are saved after each successful handshake and
restored during tls_init(), enabling session resumption across
device reboots without a full handshake.

Backend-agnostic: works with any settings backend (NVS, ZMS, FCB,
filesystem).

Signed-off-by: Rithic Chellaram Hariharan <gr8rithic@gmail.com>
2026-04-15 05:48:42 -04:00
Marcin Niestroj
561120f300 modem: uart_isr: support mdm-dtr-gpios
Support controlling mdm-dtr-gpios in uart_isr, same as it is already
supported in uart_async and uart_async_hwfc.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2026-04-15 05:38:31 -04:00
Sanjay Vallimanalan
208a2d3fa8 net: ocpp: Add TLSv1.3 support
Added support for TLSv1.3 to the OCPP subsystem by enabling
TLS secure sockets. This allows secure WebSocket
connections over TLSv1.3 during OCPP communication.

Signed-off-by: Sanjay Vallimanalan <sanjay@linumiz.com>
2026-04-15 05:37:57 -04:00
Kapil Bhatt
df9a974782 modules: hostap: Display WEP Open/Shared in status
Instead of WEP show WEP-OPEN and WEP-SHARED in status.

Signed-off-by: Kapil Bhatt <kapil.bhatt@nordicsemi.no>
2026-04-14 22:37:55 -04:00
Lyle Zhu
47b1e29717 bluetooth: rfcomm: convert DLC list from linked list to sys_slist
Convert the RFCOMM DLC (Data Link Connection) management from a manual
linked list implementation using _next pointers to use Zephyr's
sys_slist API. This change improves code maintainability and safety by
using the standard list handling primitives.

Key changes:
- Replace bt_rfcomm_dlc._next with sys_snode_t _node for list handling
- Convert bt_rfcomm_session.dlcs from pointer to sys_slist_t
- Update rfcomm_dlcs_lookup_dlci() to use
  SYS_SLIST_FOR_EACH_CONTAINER_SAFE
- Update rfcomm_dlcs_remove_dlci() to use
  sys_slist_find_and_remove()
- Replace manual list traversal with sys_slist iterators throughout
- Initialize session DLC list with sys_slist_init() in
  rfcomm_session_new()
- Use sys_slist_is_empty() instead of NULL pointer checks
- Use sys_slist_prepend() for adding DLCs to session

The conversion eliminates manual pointer manipulation and reduces the
risk of list corruption while maintaining the same functional behavior.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-04-14 22:37:49 -04:00
Pieter De Gendt
85a0e87743 net: lib: coap: client: Improve timeout check for multicast requests
Multicast requests should only check mcast_timeout in timeout_expired.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-04-14 22:37:40 -04:00
Pieter De Gendt
139e2f269d net: lib: coap: client: Calculate next resend timeout
Instead of waiting the full socket poll period, calculate the next timeout
to resend messages.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-04-14 22:37:40 -04:00
Pieter De Gendt
76c7c84daf net: lib: coap: client: Reset canceled requests instead of release
Clear the request slot if we cancel them. release_internal_request is
wrong for cancel: Its purpose is to keep token/MID data so late responses
can be matched. But handle_response just silently drops responses for
released slots anyway.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-04-14 22:37:40 -04:00
Szymon Janc
97a39757e2 Bluetooth: Shell: Fix crash in connect command
When address type was not provided calling bt_do_connect_le
leads to crash due to reading argv[2].

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2026-04-14 22:36:10 -04:00
Jedrzej Czykier
ac3eb6d478 instrumentation: kconfig: disable dynamic trigger by default
INSTRUMENTATION_DYNAMIC_TRIGGER currently always defaults to 'y', which
forcefully selects RETAINED_MEM and related drivers. This causes
Kconfig warnings on boards lacking the required `zephyr,retained-ram`
devicetree nodes.

Since this feature relies on specific hardware configurations, it
should be enabled by default only if such configuration is present.

Signed-off-by: Jedrzej Czykier <jczykier@antmicro.com>
2026-04-14 22:35:54 -04:00
Andrii Chmutov
c02bf19bfd instrumentation: kconfig: select UART_CONSOLE
Select `UART_CONSOLE` when instrumentation is enabled. Similarly to
`UART_INTERRUPT_DRIVEN`, this option is required for host-device
communication via UART.

Signed-off-by: Andrii Chmutov <achmutov@antmicro.com>
2026-04-14 22:35:54 -04:00
Egill Sigurdur
50cf2ba410 net: sockets: support FIONWRITE ioctl for TCP
Add support for getting the number of bytes queued for TCP TX
that have not yet been acknowledged. Follows FreeBSD's API.

Signed-off-by: Egill Sigurdur <egill@egill.xyz>
2026-04-14 22:34:42 -04:00
Guðni Már Gilbert
04ab47f24d build: avoid including unnecessary directories
Folders which have menuconfig can be conditionally included

Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
2026-04-14 22:32:15 -04:00
Nikhil Namjoshi
d619f4e501 net: Add net_pkt_set_data API return error handling
There some more instances of net_pkt_set_data API
whose return code is not being checked.

Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
2026-04-14 22:31:56 -04:00
Nikhil Namjoshi
87bab421db net: Add net_pkt_write API return error handling
There some more instances of net_pkt_write API
whose return code is not being checked.

Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
2026-04-14 22:31:56 -04:00
Nikhil Namjoshi
79f363da92 net: Add net_pkt_acknowledge_data API return error handling
There some more instances of net_pkt_acknowledge_data
API whose return code is not being checked.

Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
2026-04-14 22:31:56 -04:00
Nikhil Namjoshi
2a055077dc net: Add net_pkt_skip API return error handling
There some more instances of net_pkt_skip API whose
return code is not being checked.

Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
2026-04-14 22:31:56 -04:00
Yangbo Lu
bb599be0b3 net: ptp: handle GRAND_MASTER state properly in state machine
In IEEE 1588 standard, there was actually no GRAND_MASTER port state.
We should treat GRAND_MASTER as same as MASTER state (TIME_TRANSMITTER)
in code.

So, added the case PTP_PS_GRAND_MASTER handling same with
PTP_PS_TIME_TRANSMITTER. Otherwise port entering PTP_PS_GRAND_MASTER
won't go out of the state. Also removed switching PTP_PS_TIME_TRANSMITTER
to PTP_PS_GRAND_MASTER which was useless.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
2026-04-14 22:30:42 -04:00
Tomi Fontanilles
6b1d0f010b secure_storage: its_transform: aead: enable PSA_CRYPTO
This implementation relies on PSA Crypto. Make sure it's enabled.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2026-04-14 22:30:32 -04:00
Maochen Wang
8afc59276f random: select CONFIG_PSA_CSPRNG_GENERATOR if ENTROPY_NEEDS_PRNG
MCUX TRNG triggers hardware errors (TRNG_MCTL_ERR) when used as
continuous random source via HARDWARE_DEVICE_CS_GENERATOR, causing
sys_csrand_get() assertion failures.
On platforms where CONFIG_ENTROPY_NEEDS_PRNG is set 'sys_csprng_get()'
cannot poll directly the entropy device, but it needs to apply some
PRNG on top of it. Therefore enable CONFIG_PSA_CSPRNG_GENERATOR.
Fixes #107087

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2026-04-14 22:30:25 -04:00
Martin Stumpf
10989f9702 settings: runtime: fix nullpointer dereference in settings_runtime_set
When `h_set` is unset in the handler (which is allowed according to the
docs), then this function causes a nullpointer dereference because
it has no check for this.

This change applies the behavior of `settings_runtime_get` to
`settings_runtime_set` to catch this case as expected.

Signed-off-by: Martin Stumpf <finomnis@gmail.com>
2026-04-14 22:29:31 -04:00
Jordan Yates
2bdcf37f99 modem: cellular: fix dormant state control
According to the networking documentation:

> The network association status is represented with NET_IF_DORMANT flag

Therefore, the flag should be set at any time that the network is not
associated with. This is achieved by setting the flag at boot, and only
controlling the dormant state at entry/exit from the `REGISTERED` state.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2026-04-14 22:28:46 -04:00
Nicholas Lowell
9369f96a6c ipc: open-amp: make vring alignment configurable
allow for configurable vring alignment for better system
flexibility instead of hard-coded 16 byte alignment
which could be unacceptable for cache-managed systems of different
cache-line sizes

Signed-off-by: Nicholas Lowell <Nicholas.Lowell@lexmark.com>
2026-04-14 22:28:37 -04:00
Ofir Shemesh
cd85e0e890 net: tcp: fix use-after-free in net_tcp_foreach()
net_tcp_foreach() drops tcp_lock before the callback and re-acquires
it afterwards. A concurrent tcp_conn_release() can free the next
node cached by SYS_SLIST_FOR_EACH_CONTAINER_SAFE during this window,
causing the iterator to follow a dangling pointer on the next
iteration.

Move context teardown in tcp_conn_release() inside the tcp_lock
critical section and keep tcp_lock held across the callback in
net_tcp_foreach(). No current callback acquires tcp_lock.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2026-04-14 22:28:30 -04:00
Johan Hedberg
f9745c72b7 Bluetooth: Host: Fix missing responder address type
One of the branches in the Enhanced Connection Complete HCI event handler
was only partly setting the responder address, i.e. setting the address
value but not the address type. The comment above indicates that the code
expected the Advertising Set Terminated event handler to take care of the
rest, but it's still not ideal that in the intermediate state this field
doesn't contain a valid address (it would indicate a public address type
but with the RPA value).

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-14 22:28:21 -04:00
Johan Hedberg
4228c796e3 Bluetooth: Controller: shell: Use inline string conversion helper
Take advantage of the new inline address to string conversion helper,
since it eliminates the need to explicitly declare a buffer variable on
the stack.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-14 22:24:10 -04:00
Johan Hedberg
a3e1e6a69e Bluetooth: audio: Take advantage of the new inline string helpers
Take advantage of the new string conversion helpers to avoid having to
declare explicit on-stack variables.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-14 22:24:10 -04:00
Johan Hedberg
7b7c746cd5 Bluetooth: Host: Take advantage of the new inline string helpers
Take advantage of the new string conversion helpers to avoid having to
declare explicit on-stack variables.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-14 22:24:10 -04:00
Johan Hedberg
0a59ae3155 Bluetooth: Host: Add inline string conversion helper for connections
Add a helper API to convert inline (on the stack) the peer address of a
connection to a string.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-14 22:24:10 -04:00
Johan Hedberg
9197132047 Bluetooth: Introduce public address to string inline APIs
The Bluetooth stack has until now had private helpers to return an inline
pointer to a string - something which can be useful e.g. as part of
printk()/printf() call parameters. The reason these were never made public
is that they are not safe when a format string contains more than one
invocation of these.

This commit introduces replacement APIs which allocate an on-stack buffer,
thereby allowing arbitrary number of calls within the parameters of an
output formatting call. The new APIs are defines, since the solution uses
an encapsulating struct to force an on-stack copy, which then requires a
translation to access the struct-internal string member variable.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-04-14 22:24:10 -04:00