Commit graph zephyr/subsys
Author SHA1 Message Date
Anton Rejoe
8c3999df70 net: wifi: add OWE security type support
Adds WIFI_SECURITY_TYPE_OWE to the Wi-Fi security
enum and propagates it through management helpers,
shell, credentials library and Kconfig.

Signed-off-by: Anton Rejoe <antonrejoe@gmail.com>
2026-06-11 15:01:41 -04:00
Johann Fischer
c49b758d87 usb: device_next: respect wLength in CDC NCM to-host control handler
Limit the number of bytes that will be copied to the DATA IN buffer in
the CDC NCM implementation.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-06-11 15:51:06 +02:00
Johann Fischer
552ca37125 usb: device_next: dfu: fix the possible null pointer dereference
The buf parameter in handle_download() is allowed to be NULL. Check it
explicitly before using it for the length calculation or as an argument
for the callback.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2026-06-11 15:50:52 +02:00
David Piskula
1b520dc972 net: mcp: add MCP server implementation
Based on spec 2025-11-25, tool support, StreamableHTTP

Signed-off-by: David Piskula <david.piskula@nxp.com>

Assisted-by: Claude:claude-opus-4-5-20251101
2026-06-11 15:48:36 +02:00
Surya Prakash T
8b17f8e207 net: zperf: make TCP receiver buffer size configurable
The TCP receiver buffer in zperf_tcp_receiver.c was previously
hardcoded to 1500 bytes, which limited throughput on fast connections.

Introduce CONFIG_NET_ZPERF_TCP_RECEIVER_BUF_SIZE as a Kconfig integer
option (default 1500, range 256 to 65535). This allows users to scale
the buffer size based on their hardware capabilities and application
requirements.

Signed-off-by: Surya Prakash T <suryat@aerlync.com>
2026-06-11 14:13:58 +02:00
Qingling Wu
b70dd015a7 hostap: net: add support for NAN
Add Wi-Fi NAN (Neighbor Awareness Networking) support to Zephyr
including event handling, management API, and shell commands.
NAN enables devices to discover services and communicate with
nearby devices without requiring a traditional access point.

This commit includes:
- NAN management APIs and event handling
- Shell commands for NAN operations (publish, subscribe, transmit)
- Build test configuration and documentation

Signed-off-by: Qingling Wu <qingling.wu@nxp.com>
2026-06-11 14:12:06 +02:00
Flavio Ceolin
3f04379cbe sd: mmc: avoid left shift signed UB
cast uint8_t to uint32_t before << 24 to avoid signed UB

By undefined behavior sanitizer:
runtime error: left shift of 128 by 24 places cannot be
represented in type 'int'

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-06-10 20:11:25 -04:00
Flavio Ceolin
7bc1be77cb net: lwm2m: avoid left shift signed UB
cast uint8_t to uint32_t before << 24 to avoid signed UB in
buf_read_be32

By undefined behavior sanitizer:
runtime error: left shift of 128 by 24 places cannot be
represented in type 'int'

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-06-10 20:11:25 -04:00
Flavio Ceolin
5a90cfe76e net: coap: avoid left shift signed UB
cast uint8_t to uint32_t before << 24 to avoid signed UB in
coap_option_value_to_int

By undefined behavior sanitizer:
runtime error: left shift of 128 by 24 places cannot be
represented in type 'int'

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-06-10 20:11:25 -04:00
Flavio Ceolin
9194a27783 mgmt: osdp: avoid left shift signed UB
cast uint8_t to uint32_t before << 24 to avoid signed UB.

By undefined behavior sanitizer:
runtime error: left shift of 128 by 24 places cannot be
represented in type 'int'

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-06-10 20:11:25 -04:00
Flavio Ceolin
8394a0b0e4 lorawan: clock_sync: avoid left shift signed UB
cast uint8_t to uint32_t before << 24 to avoid signed UB in
clock_sync_package_callback.

By undefined behavior sanitizer:
runtime error: left shift of 128 by 24 places cannot be
represented in type 'int'

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-06-10 20:11:25 -04:00
Philipp Steiner
91db82a245 net: sockets: validate ancillary element bounds
NET_CMSG_NXTHDR() only guarantees room for another control message
header; it does not guarantee room for the complete aligned element.
Check the remaining buffer before writing the payload.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-06-10 17:35:01 -04:00
Emil Gydesen
d0834666d1 Bluetooth: ASCS: Use is_valid_num_ases for is_valid_stop_len
Instead of just checking the lower limit, use
is_valid_num_ases to also test the upper limit.
This approach is used by all other control point operations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-10 13:13:48 +02:00
Lyle Zhu
98e4c16d45 bluetooth: host: classic: fix SDP attribute parsing recursion check
Add missing type check in sdp_attr_parse() before recursively parsing
data element sequences. When checking the type of the next data if it
is a sequence, it did not first check if the current type is a
sequence.

It could lead to incorrect recursive parsing when the current type is
not a sequence but the next byte was incorrectly identified as a
sequence.

Fix the issue by checking the current data type firstly.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-06-10 13:12:11 +02:00
Tomasz Moń
74d6e4a21c usb: device_next: hid: Add verify callback for Set Report request
Add new optional callback that lets application decide whether Set
Report payload should be received or not. This allows applications to
stop Set Report control transfer handling during Data OUT stage.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-06-10 13:11:36 +02:00
Tomasz Moń
70952dee35 usb: device_next: Allow handler to STALL Data OUT stage
Universal Serial Bus Specification Revision 2.0 9.2.7 Request Error
states "It is preferred that the STALL PID be returned at the next
Data stage transaction, as this avoids unnecessary bus activity.".

USB device_next implementation always attempted to receive Data OUT
stage without asking the handler if request can be handled. The only
case where the Data OUT stage was STALLed was when there was not enough
memory to allocate Data OUT buffer.

Do not automatically enqueue buffer to receive Data OUT stage. Call the
handler first with NULL buffer to determine whether the Data OUT stage
can be received. The handler will be called again after Data OUT stage
is received (it may not be called if there is not enough memory to
allocate Data OUT buffer, or if host aborts the transfer).

Modify all in-tree control transfer handlers to perform sanity check
before Data OUT stage is received. Out-of-tree classes that handle
control transfers with Data OUT stage will have to be updated. It was
chosen to implement this as a breaking change in order to not add any
new callbacks and to encourage device implementations to STALL Data OUT
stage as preferred by the USB specification.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2026-06-10 13:11:36 +02:00
Emil Gydesen
9f5639ea75 Bluetooth: BAP: UC: Fix poorly worded "NULL is NULL" log
Fix poorly worded log statement.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-06-10 10:53:53 +02:00
Johan Hedberg
fe36ed31e5 Bluetooth: Host: Fix use-after-unref in bt_hci_le_enh_conn_complete
bt_hci_le_enh_conn_complete() obtains a reference via
find_pending_connect() but drops it immediately after the
bt_conn_connected() callback, while the function still dereferences
conn->role afterwards in the central-role scanner restart block.

Using a pointer after its reference has been dropped is a
use-after-free in API contract terms, even if in practice the
connection survives because other references (the conn array's
intrinsic reference, L2CAP, etc.) keep the object alive at this
point.

Move the bt_conn_unref() call to the end of the function so the
locally held reference outlives all uses of conn.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
7367ca6b8b Bluetooth: AVRCP: Fix use-after-unref in cover art L2CAP connect
bt_avrcp_cover_art_ct_l2cap_connect() obtains a reference to the ACL
connection via bt_avrcp_ct_get_acl_conn() but then immediately drops
that reference before continuing to use the conn pointer for
bt_conn_index() and bt_bip_l2cap_connect(). Using a pointer after
its reference has been dropped is a use-after-free in API contract
terms, even if in practice the underlying connection survives because
other references (e.g. the L2CAP channel, the ACL link itself) keep
the object alive while AVRCP cover art is in use.

Move the bt_conn_unref() call to after the last use of conn on each
return path so that the locally held reference outlives all uses.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
30cca0398f Bluetooth: Mesh: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded variants) with bt_conn_drop(&conn) which
performs both operations atomically in a single step. The guard is
unnecessary because bt_conn_drop() handles a NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
572b76130d Bluetooth: Classic: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded variants) with bt_conn_drop(&conn) which
performs both operations atomically in a single step. The guard is
unnecessary because bt_conn_drop() handles a NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
6455871bcf Bluetooth: Host: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded variants) with bt_conn_drop(&conn) which
performs both operations atomically in a single step. The guard is
unnecessary because bt_conn_drop() handles a NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
4c30188d60 Bluetooth: Audio: Use bt_conn_drop() where applicable
Replace the two-line pattern:

  bt_conn_unref(conn);
  conn = NULL;

(and equivalent if-guarded or take-then-unref-then-NULL variants) with
bt_conn_drop(&conn) which performs both operations atomically in a
single step. The guard is unnecessary because bt_conn_drop() handles a
NULL pointer internally.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
9cda39e08c Bluetooth: Host: Add bt_conn_drop() API
Add a new bt_conn_drop() function that atomically drops a connection
reference and clears the source pointer in a single step. This mirrors
the recently added net_buf_drop() API and replaces the common pattern:

  bt_conn_unref(conn);
  conn = NULL;

The new API handles a NULL pointer internally, so any guard around it
is unnecessary.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Johan Hedberg
18b85f7d06 Bluetooth: ISO: Use bt_conn_take() for ACL reference transfer
Replace the manual two-step pointer transfer:

  struct bt_conn *acl = iso->iso.acl;
  if (acl != NULL) {
          iso->iso.acl = NULL;
          ...
  }

with bt_conn_take(), which atomically extracts the reference and clears
the original pointer in a single step.

Assisted-by: GitHub Copilot:claude-opus-4.7
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 10:53:36 +02:00
Philipp Steiner
c2daa91826 net: shell: ptp: show P2P port details
Extend the PTP port shell output with peer-to-peer delay information,
including the minimum Pdelay request interval, pending Pdelay sequence,
Pdelay timer state, and neighbor rate ratio.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-06-10 09:36:21 +02:00
Philipp Steiner
434f35affd net: ip: reserve multicast slots for UDP P2P
Increase the IPv4 and IPv6 multicast address defaults when UDP P2P is
selected so PTP can join both default and peer-delay multicast groups.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-06-10 09:36:21 +02:00
Philipp Steiner
92acc9c0d6 net: ptp: add peer-to-peer delay support
Add a configurable PTP delay mechanism selection and implement the
peer-to-peer delay exchange for Pdelay_Req, Pdelay_Resp, and
Pdelay_Resp_Follow_Up messages.

Update the PTP clock delay calculation to use peer link delay in P2P
mode, track neighbor rate ratio from Pdelay samples, and route Pdelay
traffic to the peer-delay multicast addresses for UDP and L2 transports.

Reject unsupported one-step Pdelay_Resp messages, invalid Pdelay
exchanges, missing event RX timestamps, and unrealistic peer delay
samples. Also protect the sync servo from large post-lock outliers so
invalid event timestamps do not enter the PI controller.

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-06-10 09:36:21 +02:00
Johan Hedberg
1b7ce6b546 mgmt: ec_host_cmd: Use net_buf_drop() for USB RX buf on error
ctx->usb_rx_buf is a persistent member of the device context struct.
On error paths where the enqueue fails, the buffer was unreferenced
but the pointer was left dangling. Use net_buf_drop() to both
unreference and clear the pointer in one step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Johan Hedberg
e445e86642 canbus: isotp: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Johan Hedberg
bae93e076e usb: legacy: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Johan Hedberg
8d1110e446 usb: device_next: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Johan Hedberg
684aca047a net: tcp: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Johan Hedberg
42a9efc1ea mgmt: mcumgr: transport: Use net_buf_drop() where applicable
Replace the two-line pattern:

  net_buf_unref(buf);
  buf = NULL;

with net_buf_drop(&buf) which performs both operations
atomically in a single step.

Assisted-by: GitHub Copilot:claude-sonnet-4.6
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-06-10 07:48:40 +02:00
Flavio Ceolin
babc0900ed fs: ext2: reject superblock with zero group divisors
ext2_verify_disk_superblock() did not validate that the on-disk fields
s_blocks_per_group and s_inodes_per_group are non-zero. Both are later
used as divisors during mount-time initialization:

  - get_ngroups() in subsys/fs/ext2/ext2_diskops.c divides and modulos
    s_blocks_count by s_blocks_per_group when ext2_fetch_block_group()
    runs from ext2_init_fs().
  - get_itable_entry() in the same file divides (ino - 1) by
    s_inodes_per_group when fetching the root inode during mount.

Reject both fields up front in the superblock validator so the mount
fails with -EINVAL before any block-group or inode I/O occurs.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2026-06-09 22:54:32 +02:00
Ashutosh Desai
cba1d1a836 posix: timer: use explicit cast for relative duration conversion
ts_to_ms() returns int64_t but the result was assigned to a uint32_t
variable without an explicit cast, relying on implicit narrowing.
Add an explicit (uint32_t) cast to document the intentional truncation
for relative timeouts, which are expected to be small values that fit
within uint32_t.

Signed-off-by: Ashutosh Desai <ashutoshdesai993@gmail.com>
2026-06-09 22:54:20 +02:00
Ashutosh Desai
b980a2146c posix: timer: fix TIMER_ABSTIME using wrong reference clock
timer_settime() with TIMER_ABSTIME computed the remaining duration by
subtracting k_timer_remaining_get(), which returns the time remaining
on the previous kernel timer, instead of the current value of the clock
associated with the timer as required by POSIX.

Fix this by storing the clockid from timer_create() in struct timer_obj
and using the existing timespec_to_timeoutms() helper in the TIMER_ABSTIME
path. That function reads the current clock via sys_clock_gettime() and
returns the correct relative duration, matching the pattern already used
by pthread_mutex_timedlock() and sem_timedwait() in this subsystem.

Fixes #107780
Signed-off-by: Ashutosh Desai <ashutoshdesai993@gmail.com>
2026-06-09 22:54:20 +02:00
Benjamin Cabé
df448d3d2a shell: name unused shell_thread parameters
Omitting the parameter name in a function definition is a C23 extension.
Fix this by naming second and third parameter in shell_thread function
definition to address compilation warning promoted to error in CI with
LLVM.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-06-09 22:53:27 +02:00
Phil Hindman
9d717a9161 shell: Move init code from the shell_thread to shell_init
Up to now, some initialization has been deferred from the shell_init
function (which starts the shell_thread) to the shell_thread function. When
using SHELL_AUTOSTART this is fine, but when autostart is disabled this
causes a race between the shell_thread and whatever thread eventually calls
shell_start, because shell_start needs initialization to have completed
before it runs.  So, move the remaining initialization code from the
beginning of the shell_thread to shell_init (before starting the
shell_thread).

Signed-off-by: Phil Hindman <phindman@xes-inc.com>
2026-06-09 19:56:07 +02:00
Siddhant Modi
26a713f8b4 net: wifi: generalize Enterprise credential handling
Allow the Wi-Fi certificate helper library to be used by Enterprise
credential users beyond the hostap/wpa_supplicant backend.

This lets offloaded Wi-Fi drivers load Enterprise TLS credentials through
the common Wi-Fi management path.

Signed-off-by: Siddhant Modi <siddhant.modi@gmail.com>
2026-06-09 15:37:14 +02:00
Gerson Fernando Budke
3424082022 mgmt: updatehub: validate inner metadata object length
z_impl_updatehub_probe() checks that the outer metadata object
array has exactly two elements, but then accesses objects[1].objects[0]
without checking that the inner array is non-empty. A server response
whose second object array is empty leaves that element zero-initialized,
so objects[1].objects[0].objects.sha256sum is NULL and the following
strlen() dereferences a NULL pointer, crashing the agent.

Reject metadata whose inner object array is empty before dereferencing
it, for both the 'any boards' and 'some boards' layouts.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Gerson Fernando Budke
8747634ed7 mgmt: updatehub: avoid closing fd 0 in cleanup_connection()
ctx.sock was set to 0 after cleanup, but 0 is a valid file
descriptor (stdin). If cleanup_connection() were called without an
open socket, zsock_close(0) would close stdin.

Guard the close with ctx.sock >= 0 and use -1 as the invalid
socket sentinel.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Gerson Fernando Budke
4a7bdd9347 mgmt: updatehub: use msgtype parameter in send_request()
coap_packet_init() was hardcoded to COAP_TYPE_CON, ignoring the
msgtype parameter. This meant report() calls passing COAP_TYPE_NON_CON
were silently sent as confirmable messages.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Gerson Fernando Budke
eafc077d52 mgmt: updatehub: fix hardware compatibility prefix match
strncmp with strlen(CONFIG_BOARD) only compares the first N
characters, allowing a supported_hardware entry like
"frdm_k64f_extra" to incorrectly match CONFIG_BOARD="frdm_k64f".
This could cause the device to accept firmware intended for a
different board variant.

Use strcmp for an exact match. Both strings are null-terminated.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Gerson Fernando Budke
69bbed5e60 mgmt: updatehub: fix missing null terminator in metadata copy
memcpy(metadata_copy, metadata, strlen(metadata)) does not copy the
null terminator. Since metadata_copy comes from k_malloc (unzeroed),
the subsequent strlen(metadata_copy) reads past the copied data into
uninitialized heap memory, and json_obj_parse may process garbage
data or crash.

Zero the buffer before copying to ensure proper null termination.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Gerson Fernando Budke
d09db89a87 mgmt: updatehub: fix error message never sent in report()
strncmp(report.previous_state, "", sizeof("") - 1) always returns 0
because sizeof("") - 1 is 0, and strncmp with length 0 always
returns 0 per the C standard. This means report.error_message was
always set to "" and the server never received actual error details.

Replace with a direct check for a non-empty string. Guard the check
against a NULL previous_state, which state_name() can return for an
out-of-range state (the UPDATEHUB_FLASH_INIT_ERROR case passes a
response code instead of a state), so the new check does not
dereference a NULL pointer.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Gerson Fernando Budke
29e3476501 mgmt: updatehub: fix socket leak in start_coap_client()
When DTLS setsockopt or zsock_connect failed after socket creation,
the error path used ret to decide whether to call cleanup_connection().
However ret was set to -1 after socket creation, so the check
(ret > 0) was false and the socket was never closed.

Additionally, ret was set to 1 before socket creation, so if
zsock_socket itself failed, cleanup_connection() would be called
on an invalid file descriptor.

Replace the ret-based cleanup check with (ctx.sock >= 0) which
directly reflects whether a socket exists that needs closing.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Gerson Fernando Budke
551d3f92b3 mgmt: updatehub: Fix race condition
The UpdateHub subsystem has a race condition between the background
autohandler (system workqueue) and user-triggered operations (shell
commands or direct API calls). Both paths share the global ctx
structure without synchronization, allowing concurrent calls to
prepare_fds() which writes beyond the single-element ctx.fds[1]
array when ctx.nfds is already 1, corrupting adjacent memory
(ctx.sock) and leading to DoS or undefined behavior.

Replace the unused struct k_sem semaphore with a static K_MUTEX_DEFINE
to serialize access to the shared ctx across z_impl_updatehub_probe(),
z_impl_updatehub_update(), and z_impl_updatehub_report_error().

Add a bounds check to prepare_fds() (returning -ENOMEM when ctx.nfds
>= ARRAY_SIZE(ctx.fds)) as defense-in-depth against Out-of-Bounds
writes, and propagate the error through start_coap_client().

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2026-06-09 13:41:55 +02:00
Sylvio Alves
511be4d07c shell: kernel thread stacks: add cpu affinity on smp
Display which CPU each thread and interrupt stack is running on when
SMP is enabled. Shows CPU ID as the last column for clarity and proper
alignment. On non-SMP systems, output remains unchanged.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-09 11:55:44 +02:00
Jukka Rissanen
d0838179af net: quic: Fix client endpoint reuse breaking HTTP/3 tests
Client quic_connection_init() looked up endpoints by remote address
only. A stale client endpoint could be reused without being linked to
the new connection context's endpoints list, so TLS setsockopt returned
ENOTCONN. Orphaned endpoints also accumulated and could exhaust the small
endpoint pool, causing later tests to hang.

Always allocate a fresh client endpoint per connection context, release
any orphaned client endpoints for the same remote before allocation,
and close a leftover client connection fd in the HTTP/3 test before hook
when a prior test failed before after() ran.

Fixes intermittent failures in tests/net/lib/http_server/h3.

Assisted-by: Cursor:Auto
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2026-06-09 10:31:59 +02:00