Commit graph zephyr/subsys
Author SHA1 Message Date
Dhruv Menon
fa02529087 settings: reduce redundant work in line encoder
Skip a zero-length name write_cb, reuse the name length already
measured for the optional length field, and grow copy/cmp scratch
buffers to 32 bytes to match the write path.

Signed-off-by: Dhruv Menon <dhruvmenon1104@gmail.com>
2026-09-07 21:08:01 -04:00
Dhruv Menon
200102074a settings: check name write result in line encoder
settings_line_write() ignored write_cb for the setting name, so a
failed name write could still report success after the value was
appended.

Signed-off-by: Dhruv Menon <dhruvmenon1104@gmail.com>
2026-09-07 21:08:01 -04:00
Emil Gydesen
2548b7b100 Bluetooth: Host: Set adv->options only on success
If the parameters failed to be set, we should not modify
the advertising set's options.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-07 21:07:36 -04:00
Richard Osterloh
ceb8d2fd7f modbus: allow RX processing on a dedicated workqueue
Received-ADU processing (server_work running modbus_rx_handler) is
submitted to the system workqueue. On a client that handler releases the
transaction waiting on client_wait_sem, so when the system workqueue is
busy (for example an active networking stack) or is the caller's own
context, response handling is delayed past the client timeout and reads
fail with -EIO even though the reply arrived on time.

Add MODBUS_WORKQUEUE, following the USB CDC ACM implementation. When
enabled, received ADUs are processed on a workqueue owned by the Modbus
subsystem instead of the system workqueue. The serial and raw RX submit
sites are routed through modbus_work_submit() so the queue selection
lives in one place.

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2026-09-07 21:06:56 -04:00
Fabio Baltieri
e17d4c6c86 device: Add DEVICE_DT_INST_GET_COMMA macro
Add DEVICE_DT_INST_GET_COMMA helper macro to include/zephyr/device.h to
easily get a device pointer followed by a comma when expanding
devicetree foreach iterators like DT_INST_FOREACH_STATUS_OKAY.

Update drivers, soc, subsys, and tests to use the common definition.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Assisted-by: Antigravity:gemini-1.5-pro
2026-09-07 17:07:48 +01:00
Flavio Ceolin
e72a9d9498 net: http: server: fix NULL deref on HTTP/2 CONTINUATION frames
The frame header handler cleared current_stream even in the middle of a
header block, so the dynamic POST/PUT/PATCH dispatch dereferenced NULL
once a CONTINUATION frame completed the block. Keep the stream bound
while a continuation is expected, reject stray or cross-stream
CONTINUATION frames, and guard the dynamic dispatch like its siblings.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-07 17:07:37 +01:00
Benjamin Cabé
cde42c4bfc usb: device_next: dfu: write to the image's own flash area
dfu_flash_write() used flash_img_init(), which targets one partition
fixed at build time (slot1_partition when the application runs from
slot0_partition, slot0_partition otherwise), rather than the image's
own area ID that dfu_flash_read() already uses. Downloads therefore all
landed in that partition, whichever alternate setting was selected.

Any image that is not that partition is affected: enabling both
CONFIG_USBD_DFU_FLASH_SLOT0 and CONFIG_USBD_DFU_FLASH_SLOT1 always
mis-targets one of the two. A lone image, as in samples/subsys/usb/dfu,
happens to match, which is why this went unnoticed; the legacy class
writes to a single hardcoded area and rejects downloads to any other.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-09-07 18:07:02 +02:00
Emil Gydesen
05d6a3dbb6 Bluetooth: ISO: Make bt_iso_chan_state_str public
Make the existing function to return a string representation
of an ISO state public.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-07 17:54:48 +02:00
Emil Gydesen
60ad721a83 Bluetooth: ISO: Add function to get bt_iso_chan from bt_conn
It is possible to get the ISO bt_conn object from e.g.
bt_conn_foreach but it is pretty useless without
being able to get the `bt_iso_chan` that it is linked to.

Added function to get the bt_iso_chan object from the
bt_conn ISO object.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-07 17:54:48 +02:00
Benjamin Cabé
558fdf2ce4 net: tcp: wake connect() poll waiters when the handshake fails
tcp_conn_close() and net_tcp_put() reset connect_sem, which used to wake
both the thread blocked in net_tcp_connect() and the k_poll() waiter the
socket layer registers there for a pending non-blocking connect. Since
commit a08e6b9597 ("kernel: sem: do not wake pollers on reset") the
poll waiter is no longer woken, so a connect refused with RST, or a
socket closed mid-handshake, left poll() and select() blocked until
their own timeout expired.

Give the semaphore instead. It now means "the connect attempt
finished", whatever the reason, so net_tcp_connect() decides from the
connection state instead of from the k_sem_take() return value;
otherwise a failed connect() would return success.

Tested with twister on native_sim and qemu_x86: tests/net,
tests/kernel/poll and tests/kernel/semaphore.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-07 09:23:39 -04:00
Eve Redero
681173c8f6 fix: tracing: ctf: add sleep_ticks tracing
Commit a672a717ca added the sleep_ticks enter/exit trace
enums 0x184 and 0x185 to factorize the sleep functions tracing,
but the metadata was not updated with the matching event classes.
Add them in the metadata.

Assisted-by: opencode:big-pickle
Signed-off-by: Eve Redero <eve.redero@gmail.com>
2026-09-07 10:34:47 +02:00
Krzysztof Chruściński
15670630bd testsuite: busy_sim: Do not use k_work if test RNG is used
Ensure that compiler is removing part that uses k_work and entropy
driver when test RNG is used. Previously runtime if clause was used
and it was leading to increased code size as k_work code needed to
be incuded even if not used.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-09-07 10:34:05 +02:00
Appana Durga Kedareswara rao
3b3bd23a9d debug: coredump: arm64: freeze other CPUs and capture live registers
A thread actively running on another CPU at panic time was previously
invisible to real debugging: coredump only captured the panicking CPU's
exception frame, so every other thread's registers came from its
k_thread.callee_saved struct -- correct for genuinely sleeping threads,
but stale (reflecting whenever it last voluntarily context switched) for
one that's actually running elsewhere right now.

Add CONFIG_DEBUG_COREDUMP_SMP_FREEZE_CPUS (default y where the arch sets
ARCH_SUPPORTS_COREDUMP_SMP_FREEZE, i.e. arm64 Cortex-A SMP). On panic,
coredump() freezes every other online CPU before dumping and thaws them
after the memory-region walk, and emits each frozen CPU's live registers
as a new coredump section (COREDUMP_CPU_SNAPSHOT_HDR_ID, tagged with CPU
index and thread pointer, reusing the arch-info block register layout).
The panicking CPU (never frozen, since freeze only targets other CPUs)
emits a zero-payload marker recording only which thread was panicking
there, which the host side uses to identify it unambiguously.

arm64 implementation (arch/arm64/core/smp.c, coredump.c): send a new SGI
to every other online CPU. Each handler captures its exact live state --
x0-x18/lr/spsr/elr via the arch_esf that _isr_wrapper() stashes at a
fixed, nesting-independent slot on its IRQ stack, plus x19-x29 via inline
asm (valid per AAPCS64) -- then spins holding whatever it held before
being frozen, untouched, until the dump finishes, and resumes via the
standard exception-return path exactly where it was interrupted. This
matters because a panic here can be recoverable (this tree's own
coredump_threads test doesn't halt/reboot after dumping).

The SGI uses a deliberately low priority (SGI_COREDUMP_FREEZE_PRIO), not
IRQ_DEFAULT_PRIORITY: a frozen CPU never returns from its handler so
_isr_wrapper() never EOIs, and per GIC priority rules only a strictly
higher-priority interrupt can preempt a still-active one. At the default
priority a frozen CPU could not service same-priority peripheral
interrupts (confirmed on hardware as Ethernet TX-done starvation during
the UDP backend); the lowest usable priority lets everything else keep
making progress while a CPU waits.

The freeze/thaw handshake uses two separate per-CPU signals: freeze_state
(IDLE/REQUESTED/CAPTURED) and a dedicated release_requested flag that
only thaw writes. Kept separate so a late-arriving CPU (whose SGI was
delayed past the freeze-side timeout) still sees a release signal instead
of stomping it with its own CAPTURED update and spinning forever; thaw
sets release_requested unconditionally for every other CPU. The handler
wait is also bounded by a 60-second wall-clock backstop (k_cycle_get_32(),
safe from any context) so no CPU is ever stuck indefinitely. A CPU that
never responds within the freeze-side timeout (never booted, or stuck
with IRQs masked) is skipped and never blocks the dump.

The host coredump log parser learns to parse the new snapshot section.

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
2026-09-04 21:45:11 -04:00
Yuheng Li
bb2dd53f7a Bluetooth: Classic: AVDTP: return NULL from avdtp_get_sep for unknown SEID
SYS_SLIST_FOR_EACH_CONTAINER leaves the loop variable pointing at the
last node when the scan comes up empty, so avdtp_get_sep() returned that
node for a SEID the endpoint never registered. Every command handler
(get caps, set config, open, start, suspend, abort, close, ...) branches
on sep == NULL to answer Reject, so an unknown SEID was instead treated
as targeting the wrong SEP: a Close carrying SEID 62 was answered against
the only registered SEP (id 8, streaming) instead of being rejected with
BAD_ACP_SEID, and PTS AVDTP/SNK/ACP/SIG/SMG/BI-23-C timed out waiting for
the Reject.

Track the match explicitly and return NULL when none is found.

Signed-off-by: Yuheng Li <liyuheng@xiaomi.com>
2026-09-04 13:42:39 -04:00
Iliya Iliev
1863f2c7d7 net: route: Clear lladdr_dst when forwarding via an on-link route
net_route_packet_if() is the path IPv4 forwarding takes when the
destination is directly connected and no route table entry matches,
that is the ipv4_route_packet() -> net_if_ipv4_addr_onlink() fallback.
It rewrites the source link address but leaves net_pkt_lladdr_dst()
holding the value ethernet_recv() stored on RX, which for a routed
packet is the router's own MAC, since the sender addressed the frame
to its gateway.

ethernet_ll_prepare_on_ipv4() treats a non-empty lladdr_dst as already
resolved and returns NET_ARP_COMPLETE without doing ARP, so
ethernet_fill_header() copies the router's own MAC into the outgoing
frame as the destination. On a router on a stick the switch then sees
a frame whose destination MAC it learned on the ingress port and drops
it, so the packet is transmitted but never reaches the next hop.

Clear lladdr_dst so L2 resolves the destination on the outgoing
interface, matching what net_route_ipv4_packet() already does on the
route table path.

Signed-off-by: Iliya Iliev <iliyailiev3592@gmail.com>
2026-09-04 13:42:26 -04:00
Fin Maaß
16aa19ac40 net: ptp: add hybrid network transmission mode
Add a hybrid network transmission mode, compatible with the hybrid_e2e
option of linuxptp: Delay_Req messages are sent as unicast directly to
the current timeTransmitter, all other messages remain multicast. If
the timeTransmitter does not answer unicast Delay_Req messages, the
port optionally falls back to multicast delay measurement.

A timeTransmitter answering unicast Delay_Req messages may advertise
its preferred interval in the Delay_Resp message instead of 0x7F
(RFC 9760, section 7.2), so the interval is evaluated regardless of the
unicast flag.

Assisted-by: Claude:claude-fable-5
Assisted-by: Claude:claude-opus-5
Signed-off-by: Fin Maaß <info@finmaass.de>
2026-09-04 13:41:51 -04:00
Fin Maaß
6b187f42f1 net: ptp: answer unicast Delay_Req messages as unicast
When a Delay_Req message with the unicast flag is received, send the
Delay_Resp message directly back to the address of the requesting
timeReceiver instead of the multicast address. As required by
IEEE 1588-2019, unicast Delay_Resp messages carry 0x7F in the
logMessageInterval field.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Fin Maaß <info@finmaass.de>
2026-09-04 13:41:51 -04:00
Fin Maaß
f6b9459f08 net: ptp: validate the delay request interval of a Delay_Resp
The logMessageInterval of a received Delay_Resp message was adopted
unchecked. The value ends up as a shift count in
port_timer_set_timeout(), so a timeTransmitter announcing an out of
range interval made the PTP Port arm its delay timer with a nonsensical
timeout.

Reject values outside the range that can be represented, and treat the
value 0x7F as not applicable instead of adopting it, as required by
IEEE 1588-2019 Table 42.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Fin Maaß <info@finmaass.de>
2026-09-04 13:41:51 -04:00
Fin Maaß
7a5915bab2 net: ptp: name the delay mechanism choice
Give the PTP delay mechanism choice a name, so that it can be
redeclared, which the white-box unit tests need to select a delay
mechanism while CONFIG_PTP itself stays disabled.

No functional change.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Fin Maaß <info@finmaass.de>
2026-09-04 13:41:51 -04:00
Emil Gydesen
915d63e193 Bluetooth: ASCS: Add cp_rsp_buf per client
Modify the buffer for control point responses to exist per client.
This is a requirement to later support handling the control point
notifications in the system workqueue, which enables support for
proper handling of notifications in case that we run out of ATT
buffers, as we need to store the response until then, and that we
may have multiple clients connected.

CONFIG_BT_MAX_PAIRED was chosen over CONFIG_BT_MAX_CONN as we only
care about paired (encrypted) connections, and this may scale
better at the cost of doing lookups on address instead of e.g.
bt_conn_index.

The unit tests for ASCS are updated to pass without any
functional changes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-04 13:41:33 -04:00
Emil Gydesen
ac1141fbc9 Bluetooth: audio: release VOCS and AICS client instances on alloc failure
Fixes issue with VCP and MICP init failures not cleaning
up allocated AICS and VOCS instances.

Assisted-by: copilot-swe-agent
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2026-09-04 13:41:29 -04:00
Yuan Bian
c200d07b04 debug: gdbstub: avoid read after aligned memory write
After writing the final aligned datum, write_sz becomes zero and the
code reads from the next aligned address even though no data remains.
This unnecessary read may access an invalid address.

Signed-off-by: Yuan Bian <bianyuan@kylinos.cn>
2026-09-04 06:24:01 -04:00
Alex Ciascai
a8aac60612 bluetooth: MPL: notify track postion when stop playback
Notify Track Position when resetting it to zero while
playback is active. Stop resets the position before
changing the Media State to Paused, which previously
supressed the Track Position notification.

Signed-off-by: Alex Ciascai <alexandru.ciascai@nordicsemi.no>
2026-09-04 06:23:40 -04:00
Cheng Chang
f8eeda1891 bluetooth: host: bip: fix DELETE_IMAGE_FUNC_BIT macro definition
The DELETE_IMAGE_FUNC_BIT macro was incorrectly defined as
BT_BIP_SUPP_FUNC_REMOTE_DISPLAY instead of BT_BIP_SUPP_FUNC_DELETE_IMAGE.
This caused the wrong function bit to be used for the delete image
operation.

Signed-off-by: Cheng Chang <cheng.chang@nxp.com>
2026-09-04 06:23:32 -04:00
Flavio Ceolin
66f334050a random: entropy: tidy up the timer fallback loop
The fallback used a uint32_t index to walk a size_t buffer and hardcoded
the copy block size to 4 rather than deriving it from the variable being
copied. Use size_t for the index and sizeof() for the block size, and
fold the manual clamp into MIN().

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-04 06:22:51 -04:00
Flavio Ceolin
49fc3efcb4 random: entropy: split requests larger than a uint16_t
entropy_get_entropy() takes the length as a uint16_t, but rand_get()
passed it a size_t straight through. A request of 65536 bytes truncated
to 0, so the driver returned success without writing anything and
sys_csrand_get() reported success for a buffer left entirely
uninitialized. Any request above 64 KiB was silently short-filled the
same way.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-04 06:22:51 -04:00
Flavio Ceolin
76eb10b5c3 random: entropy: fall back to the timer when the device is not ready
rand_get() returned -ENODEV as soon as device_is_ready() failed, before
reaching the system-timer fallback. z_impl_sys_rand_get() returns void
and discards that error, so sys_rand_get() handed the caller a buffer it
never wrote to and presented the uninitialized bytes as random data.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-04 06:22:51 -04:00
Flavio Ceolin
86c0bdda24 random: xoshiro128: check the entropy device before seeding
entropy_get_default_device() returns NULL when no zephyr,entropy node is
chosen and the arch provides no entropy device. XOSHIRO_RANDOM_GENERATOR
only depends on ENTROPY_HAS_DRIVER, which a driver can select without the
chosen node being set, so the NULL is reachable.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-04 06:22:51 -04:00
Benjamin Perseghetti
e2e84bb595 net: gptp: add static timeReceiver mode for Announce-less bridges
An IEEE 802.1AS automotive-profile bridge relays Sync and Follow_Up but
suppresses Announce. A downstream node running the stock state machine
never receives the qualified Announce that BMCA needs to move a port
into the time receiver ("slave") state, so the port never disciplines
its clock even though a valid Sync stream is arriving. The same
static-role time distribution is common in robotics sensor networks
built on 100BASE-T1 and 10BASE-T1S links, where every node is a fixed
time receiver behind an automotive-profile switch.

Add CONFIG_NET_GPTP_STATIC_TIME_RECEIVER. When set, the node is a
timeReceiver by configuration: every port is forced into the time
receiver state with port 0 passive and gm_present asserted, BMCA
Announce handling is bypassed, and asCapable and the enabled path-delay
state are held so the sync-receive machinery runs from Sync/Follow_Up
alone. The grandmaster path is unchanged when the option is off.

This mirrors the timeReceiver-only provisioning of IEEE 802.1AS-2020
clause 10.3.14 and the linuxptp clientOnly/BMCA-noop configuration used
to synchronize a Linux host behind the same bridge. Adds a sample
overlay, test coverage and documentation.

Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
2026-09-04 06:22:15 -04:00
Johan Hedberg
3bdda744f9 Bluetooth: Classic: SDP: Bound the client AttributeIDList length
sdp_client_get_attribute_id_list_len() summed the encoded size of the
attribute ID list in a uint16_t while iterating a size_t count. With
enough ranges the sum wrapped, the tailroom check in the SA and SSA
request builders passed on the wrapped value, and
sdp_client_add_attribute_id() then encoded every range into the request
PDU, writing past the end of the net_buf.

Accumulate in size_t, pass the measured length to the encoder instead of
recomputing it there, and reject lists that cannot fit in a request PDU
in bt_sdp_discover() with -EINVAL. The bound is derived from the request
with the largest fixed-size parameters, an SSA request with a 128-bit
UUID and a full-size continuation state, so a list accepted by
bt_sdp_discover() fits every request of the transaction.

Document the limit in the API.

Fixes #117579

Assisted-by: Claude:claude-fable-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-09-04 06:21:36 -04:00
Ofir Shemesh
f693af0f5e net: if: fix lock inversion in address lifetime timeout
address_lifetime_timeout() called address_expired() while holding
the global lock. address_expired() calls net_if_ipv6_addr_rm(),
which takes the interface lock, giving order global -> iface.
Other paths, such as net_if_up() via init_igmp(), take the two in
the opposite order, so they can deadlock.

Collect the expired addresses into a local list and remove them
after the global lock is released, matching what dad_timeout(),
rs_timeout() and prefix_lifetime_timeout() already do.

Signed-off-by: Ofir Shemesh <ofirshemesh777@gmail.com>
2026-09-04 06:21:28 -04:00
Fin Maaß
b97f39711a net: ptp: add l2 mcast filtering support
also add multicast membership for L2 transport.

Signed-off-by: Fin Maaß <info@finmaass.de>
2026-09-04 06:20:45 -04:00
Lyle Zhu
8855ac4626 bluetooth: classic: bip: add required app param tag validation
The `required_appl_param_tag_id` bitmask in `struct bip_function` was
unused; both `bip_server_get_req_cb()` and `bip_client_get_req_cb()`
contained a placeholder comment noting that application parameter tag
IDs were not checked.

Add `has_required_ap_tag_id()`, which iterates every set bit in the
bitmask via `__builtin_ctz()` and verifies that the corresponding
application parameter is present in the request buffer using
`bt_obex_has_app_param()`. Invoke this helper in both the server and
client request paths (GET and PUT) so BIP operations that require
specific application parameters are correctly rejected when those
parameters are absent, rather than being silently passed through.

Also rename the struct field from `required_appl_param_tag_id` to
`required_ap_tag_id` to align with the shorter naming convention
used elsewhere in the file.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-09-04 06:19:43 -04:00
Lyle Zhu
b77e8dc200 bluetooth: classic: Refactor OBEX authentication to be reusable
Move OBEX authentication functions from PBAP to the OBEX layer to make
them available for other OBEX-based profiles. The authentication
implementation remains unchanged but is now part of the generic OBEX
API rather than being PBAP-specific.

Move `bt_pbap_calculate_nonce()` to `bt_obex_generate_nonce()`. Move
`bt_pbap_calculate_rsp_digest()` to
`bt_obex_calculate_request_digest()`. Move
`bt_pbap_verify_authentication()` to `bt_obex_verify_auth_response()`.

The refactoring allows other OBEX-based profiles to use the same
authentication mechanism without code duplication.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2026-09-04 06:18:31 -04:00
Fin Maaß
8fc2eb4aea net: remove IP reference from CONFIG_NET_NATIVE
remove IP reference from CONFIG_NET_NATIVE, as
it is also needed for native packet socket support which
works on a L2 level.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-03 18:48:25 -04:00
Fin Maaß
9280c884cc net: sockets: depend on NET_NATIVE for NET_SOCKETS_PACKET
Our implementation of Packet socket support needs
native networking support. Also if NET_NATIVE is deactivated
because the user wants to use socket offloading,
packet sockets also has to be offloaded.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-09-03 18:48:25 -04:00
Ryan Erickson
73bb9e79ca sd: sdio: skip CMD11 voltage switch if already at 1.8V
sdio_card_init() unconditionally issued a CMD11 voltage switch whenever
the card advertised 1.8V support and the host controller allowed it,
even if the bus signal voltage was already 1.8V. Add a check for
card->bus_io.signal_voltage so the switch is only attempted when
actually needed.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-09-03 18:47:49 -04:00
Ryan Erickson
6cf1c9fdbf sd: return early on CMD8 timeout when SDMMC is not supported
On boards without CONFIG_SDMMC_STACK, a real SD memory card can never
be initialized regardless of what sd_common_init() decides, so
retrying CMD8 up to CONFIG_SD_RETRY_COUNT times before falling back to
the legacy/SDIO path only adds latency. When sdhc_request() reports
-ETIMEDOUT and SDMMC support isn't compiled in, return the timeout
immediately instead of the SD_RETRY sentinel so the caller switches to
the legacy initialization path right away. Builds with SDMMC support
compiled in keep the original SD_RETRY behavior and full retry budget,
since a real SD card could still need those retries.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-09-03 18:47:49 -04:00
Vinayak Kariappa Chettimada
8ca41216e8 Bluetooth: Controller: Discard PDU exceeding max length
Discard received PDU with length that exceed configured
maximum data length.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2026-09-03 12:03:17 +02:00
Krzysztof Chruściński
e31ad1f937 ipc: ipc_service: icbmsg: Fix case when stats are used
When CONFIG_STATS was enabled then wrong block_index value was used to
get address of the packet (for statistics) as block_index may already
contained high priority flag. Fix it by keeping block_index variable
untouched.

Fix use of wrong ifdef (CONFIG_STATS_NAMES to CONFIG_STATS).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-09-03 12:01:30 +02:00
Benjamin Cabé
3f244c1709 rtio: require context permission to cancel an SQE handle
z_vrfy_rtio_sqe_cancel() bounded the handle against the SQE pools but
never checked that the caller owns the context a pool belongs to. Walk
the rtio iterable section instead so the owner is known, and require
K_SYSCALL_OBJ() on it. The accepted address range is unchanged.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-03 11:59:52 +02:00
Benjamin Cabé
454a848006 rtio: fix inverted userspace SQE buffer validation
rtio_vrfy_sqe() accumulated K_SYSCALL_MEMORY() results into valid_sqe
with &=, but that macro returns true on failure, so every buffer check
contributed the opposite of its result. Negate each one.

Also check the TXRX transmit buffer read-only, as the SPI, I2C and I3C
handlers do; it is a const source buffer.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-03 11:59:52 +02:00
Flavio Ceolin
20a5687e51 pm: policy: use size_t to iterate over constraint lists
struct pm_state_constraints::count is a size_t, but
pm_policy_state_constraints_get(), pm_policy_state_constraints_put()
and pm_state_in_constraints() walked it with an int index, comparing a
signed and an unsigned value on every iteration.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-03 09:42:48 +02:00
Flavio Ceolin
c66fba7472 pm: device_runtime: tracing exit on get() early returns
pm_device_runtime_get() traces its entry and then takes two early
returns without a matching exit event: when runtime PM is not enabled
for the device, and when k_sem_take() fails. Backends that map these
hooks onto paired calls, such as SystemView's
RecordFunc()/RecordEndCall(), skew their call depth on both paths.

Route both through the existing `end` label. It is placed after the
unlock block, so the semaphore that was never taken is not given back.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-03 09:42:48 +02:00
Flavio Ceolin
53cc8973a4 pm: emit the tracing exit when suspend returns early
pm_system_suspend() traces its entry unconditionally, but the early
return taken when no power state is active leaves without a matching
exit event. Backends that map these hooks onto paired calls, such as
SystemView's RecordFunc()/RecordEndCall(), permanently skew their call
depth every time that path is hit.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-03 09:42:48 +02:00
Flavio Ceolin
f59264ce67 pm: cpu shell: initialize err before calling shell_strtoul()
shell_strtoul() only assigns to *err when parsing fails; on success it
leaves the variable untouched. cmd_cpu_lock() and cmd_cpu_idle()
declared it uninitialized and then tested `err < 0`, reading an
indeterminate value and potentially failing a perfectly valid command.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-03 09:42:48 +02:00
Flavio Ceolin
cc486ba8dc pm: cpu shell: require the substate argument for lock/unlock
Both `cpu lock` and `cpu unlock` were registered with two mandatory and
one optional argument. The shell accepts any argc in
[mandatory, mandatory + optional], so `cpu lock standby` (argc == 2) is
let through, but both handlers unconditionally parse argv[2] and read
past the arguments the shell actually populated.

The substate is documented as required in the command help, so declare
it as mandatory instead of optional.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-09-03 09:42:48 +02:00
Anas Nashif
8c942446e6 testsuite: ztest: print RunID marker when a run starts
The RunID that twister injects into a test image is only printed from
TC_END_REPORT, so nothing in the console output identifies which image
produced it until a run completes. Output captured from a previously
programmed image -- the serial port is opened before flashing by
default -- or from a run cut short by a restart is indistinguishable
from the current run, which twister's Ztest harness can only guess at
from duplicate markers or the optional boot banner.

Also print the RunID when the image starts executing, using the
distinct "RunID started:" prefix, so a run's output is bracketed by
two markers and the existing end-of-run id verification keeps its
meaning. Nothing is printed when TC_RUNID is not defined, as before.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-09-03 09:42:14 +02:00
Aditya Ganesh
fa4be45363 testsuite: ztest: src: Fix unused parameter warning
Apply ARG_UNUSED() macro to resolve the unused parameter warning

Signed-off-by: Aditya Ganesh <aditya.ganesh@intel.com>
2026-09-03 09:41:26 +02:00
Kai Cheng
2e1747c261 bluetooth: HID: fix GET_REPORT size flag bit position
HID spec v1.1.2 Table 3.4 places the Size flag of the GET_REPORT header
octet at bit 3 and marks bit 2 as reserved, but the parameter mask used
bit 2. A host would therefore set the reserved bit instead of the Size
flag, leaving the device to parse the trailing BufferSize field as report
data. HID11.TS HID11/HOS/HCT/BV-01-C additionally requires all reserved
fields of the Get_Report command to be zero.

Signed-off-by: Kai Cheng <chengkai@xiaomi.com>
2026-09-03 09:39:56 +02:00