Commit graph

44249 commits

Author SHA1 Message Date
Joakim Andersson
0fe62c6392 Bluetooth: host: Fix bug in device name shortening handling
Fix bug in device name shortening handling leading to memory
corruption.
This is triggered by an underflow in the length field of the shortened
name when set_data_len + 2 > set_data_len_max.

Fixes: #27693

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-19 10:25:49 +02:00
Joakim Andersson
f332d51d60 Bluetooth: host: Ignore failure to set passive scanner address
Ignore error when failing to set the passive scanner private address.
This can happen because in between the time we checked if the
advertiser was enabled and the time we execute the set random address
command the state of the advertiser could have changed in the
controller, and we only set the state once the command has completed
in the controller.

Fixes: #25672

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-19 10:19:03 +02:00
Joakim Andersson
2cb4548a42 Bluetooth: host: Fix not setting NRPA before starting scanner
Fix not setting NRPA before starting scanner.
Occurs with BT_PRIVACY=n and BT_EXT_ADV=y

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-19 10:19:03 +02:00
Armando Visconti
ce0cc3a7cc drivers: sensor: lsm6dsl: make the driver multi-instance
Make this driver multi-instance and use the new API.
Fixes #28390

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2020-09-18 22:08:44 -04:00
Jukka Rissanen
0e49f5570c net: tcp2: Check that connection exists in net_tcp_put()
Unit test tests/net/tcp2/net.tcp2.simple might have conn set to
null so check it here.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
ac7866c663 net: tcp2: Fix connection termination
We need to have timer that closes the connection for good if
we do not get the FIN and ACK reponse from the peer.

If there is any pending data when application does close(),
send them before sending FIN.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
13a7baf1e4 net: tcp2: Bail out if new connection cannot be created
If there is some error during connection creation, just bail
out in order to avoid null pointer access.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
4e3060a26b net: tcp2: Retrigger resend if sending window is full
If we try to send data but the sending window is full, then
try to kick the resend of the pending data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
69459507b6 net: tcp2: Fix connection state debugging
The log buffer was too short and debug messages were truncated.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
bd9f707098 net: tcp2: Print context state when closing connection
Useful in debugging.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
9cccf0ea55 net: tcp2: If the send window is full, do not try to send
If there is no space in the sending window, then return -EAGAIN
so that the caller may try later.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
29f0895b93 net: tcp2: Adjust the send window according to avail bufs
We should have a max value for sending window so that application
is not able to use all our net_bufs for queueing packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
b00adf6965 net: tcp2: Re-order connection struct fields
Order the fields in connection struct so that they use minimal amount
of memory.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
ff2aff3a32 net: tcp2: Make sure the pkt if not null
If the send_queue pkt is null, then do not try to access it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
037037cdaa net: context: Return -ENOBUFS to caller if we run out of bufs
The socket layer expects to receive -ENOBUFS if we do not have
any network buffers so cannot build a network message to be sent.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
3db319fbc3 net: tcp2: Avoid double free message
If there is an error, the net_context.c:context_sendto() will
free the net_pkt, so we must not do it here.

This commit fixes this error message:

<err> net_pkt: *** ERROR *** pkt 0x20421908 is freed already
                                     (context_sendto():1672)

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
65a3b5a68e net: tcp2: Do not close connection if we run out of memory
Usually the out-of-memory situation will clear itself eventually,
so if that happens in TCP, then keep the connection running and
let the user to decide what to do next.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
69d9eb6c94 net: socket: Wait new buffers when sending
If we run out of network buffers and cannot send data, and if
we have a blocking socket, then wait until new buffers are
available before returning. As this might lead to deadlock,
wait only max 10 seconds and return ENOMEM if we cannot get
buffers in a reasonable amount of time.

Fixes #28216

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
80d04616de net: tcp2: Honor TCP retry count limit from Kconfig file
Instead of hardcoded value of 3, use the value from Kconfig file
so that user can tweak the TCP retry count.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
28177dad6f net: conn: Use safe slist macro when searching connection
Try to catch simultaneous insert to/delete from list when
searching the connection.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
6dfb11c781 net: tcp2: Use safe version of slist macro in conn search
Use SYS_SLIST_FOR_EACH_CONTAINER_SAFE() macro when searching
the connection list so that we notice if new entries are added
or removed in the list.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Jukka Rissanen
54d05efb34 net: tcp2: Use pointer to slist node
Instead of forcing the slist node to be first in the tcp struct,
use the pointer to node when accessing the slist. This way we
can change the ordering of fields in tcp struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-09-18 22:07:53 -04:00
Alexandre Bourdiol
2b4457347d tests: posix: common: move printk() out of k_usleep() tick alignment
Move printk() out of k_usleep() tick alignment,
for a better tick synchro.

Fixes #25453

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-18 22:07:19 -04:00
Anas Nashif
a06884a4e6 actions: stale: increase operations per run
The action is currently being aborted due to a very low value. Trying
something larger to get more operation done per day.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-18 19:05:29 -04:00
Lauren Murphy
25f9b643c7 lib: os: mempool: Fix unused return values from sys_mutex_lock calls
Fixes Coverity issues 210682 and 210686.

Fixes #25983
Fixes #25984

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2020-09-18 18:02:37 -04:00
Maureen Helm
ef908a2b91 samples: subsys: Add sdhc fixture to fat_fs sample
Adds a fixture to the fat_fs sample so it only runs on boards that have
an sdhc card inserted.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2020-09-18 14:39:46 -05:00
Paul Fagerburg
a8639a0432 drivers/pinmux/stm32: add/fix pinmux for F103xG
* Add missing the PINMUX macros for UART5 pins.
* Correct a typo in STM32F1_PINMUX_FUNC_PC5_ADC12_IN15; the macro
 used PC4 instead of PC5 for ADC12_IN15.

Signed-off-by: Paul Fagerburg <pfagerburg@google.com>
2020-09-18 14:25:55 -05:00
Henrik Brix Andersen
4bfc3af759 manifest: Update CANopenNode to include v1.3 SDO/LSS bug fixes
Update the CANopenNode library to latest upstream branch v1.3-master
to bring in SDO and LSS fixes.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2020-09-18 14:07:57 -05:00
Erwan Gouriou
8b47e563e2 dts/Kconfig: Remove HAS_DTS_I2C
HAS_DTS_I2C is now selected by I2C and
always used as I2C && HAS_DTS_I2C.

It could then be purely removed.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-09-18 13:34:44 -05:00
Kumar Gala
283a057279 x86_64: Fix memory access size for locore EOI
Newer QEMU (5.1) hangs / timeouts on a number of tests on x86_64.  In
debugging the issue this is related to a fix in QEMU 5.1 that
validates memory region access.  QEMU has the APIC region only allowing
1 to 4 byte access.  64-bit access is treated as an error.

Change the APIC EOI access in locore.S back to just doing a 32-bit
access.

Fixes #	28453

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-18 13:29:00 -05:00
Anas Nashif
c1c10993c7 sanitycheck: comment cleanup and style fixes
Minor comment and style fixes.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-18 13:24:36 -05:00
Anas Nashif
fdc02b651c sanitycheck: capture timeout as reason in cases we kill qemu
If we kill qemu because of a timeout, capture this as the reason instead
of reporting the exit code.

Fixes #28040

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-18 13:24:36 -05:00
Alexandre Bourdiol
8afcffc231 tests: kernel: context: align timer init on ticks
Align to ticks so the first iteration sleeps long enough
(k_timer_start() rounds its duration argument down, not up,
to a tick boundary)

Fixes #28319

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-18 13:23:45 -05:00
Thomas Stenersen
b7336616b2 Bluetooh: Host: Fix wrong buffer in acl_total_len calc
To be squashed.

Co-authored-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2020-09-18 20:24:46 +03:00
Thomas Stenersen
3d57cdb7c3 Bluetooth: host: Use C89-style
To be squashed after review.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2020-09-18 20:24:46 +03:00
Thomas Stenersen
e28fdbb9df Bluetooth: host: Fetch L2CAP length directly
This commit will be squashed after review.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2020-09-18 20:24:46 +03:00
Thomas Stenersen
8bc00f5ead Bluetooth: host: Refactor bt_conn_recv
Re-structures the `bt_conn_recv()` to support more generic appending of
new ACL data. This also handles the possibility of receiving 0-length
ACL_START and ACL_CONT fragments, whilst maintaining existing
error-checking functionality.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2020-09-18 20:24:46 +03:00
Thomas Stenersen
a8f47a1110 Bluetooth: host: Support fragmented L2CAP header
Fixes issue #26900.

A controller may fragment an L2CAP SDUs in any way it sees fit,
including fragmenting the L2CAP header. Likewise, the receiving
controller may send the fragmented header as ACL data to the host.

The Zephyr host assumed that a `BT_ACL_START` was at least 2 bytes long,
and consequently read the two-byte length field from the buffer without
length checks.

This commit allows the `BT_ACL_START` to be less than two bytes,
updating the `conn->rx_len` onces the `BT_ACL_CONT` with the remaining
part of the length field has been received.

Signed-off-by: Thomas Stenersen <thomas.stenersen@nordicsemi.no>
2020-09-18 20:24:46 +03:00
Joakim Andersson
cccfea24c1 Bluetooth: controller: Fix Kconfig dependencies for PHY options
Fix Kconfig dependencies for enabling the controller PHY options
for LE 2M Phy  and LE Coded Phy. These options should be selectable
without connections enabled when extended advertising has been enabled.

The issue affects out-of-tree controllers that wish to use the
BT_CTLR_PHY_CODED and BT_CTLR_PHY_2M options.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-18 18:11:35 +02:00
Joakim Andersson
4cc6098af8 Bluetooth: controller: Select controller features from SoC capabilities
Select the controller feature support for data length and LE 2M PHY
based on the SoC hardware capabilities instead of relying on SoC
family.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-18 18:11:35 +02:00
Carles Cufi
b8d13d6fdd boards: nrf52840dongle: Enable serial conditionally
Do not force SERIAL and UART_INTERRUPT_DRIVEN unconditionally.

Fixes #22892.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-09-18 17:54:16 +02:00
Fabio Utzig
ae8dd14887 doc: ext: link-roles: allow non-default baseurl
Link roles, aka :zephyr_file: and :zephyr_raw: use a repo's git describe
information to create links but the baseurl is fixed to the upstream
repo. This breaks links created in repos that are forks located
somewhere else.

This commits tries to get the baseurl from west if available so it will
work correctly for forks. If fallbacks to the upstream repo if no
information can be gathered by West, or West is not available.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-09-18 17:40:05 +02:00
Siddharth Chandrasekaran
2b4ca51c85 mgmt/osdp: Fix osdp_build_ctx(); Add NULL check on ctx
osdp_build_ctx() was returning fixed NULL and the subsequent code did
not check if ctx was NULL due to osdp_build_ctx() failures. Fix both
these issues.

Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
2020-09-18 17:36:02 +02:00
Kumar Gala
59f76a291c lib: cmsis_rtos_v2: Handle possible zero length array
Change how we handle the case of
CONFIG_CMSIS_V2_THREAD_DYNAMIC_MAX_COUNT=0 so that we don't create
a zero length array.  Instead we can just ifdef out the code associated
with handling a dynamic stack allocation.

Fixes #28397

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-09-18 10:13:58 -05:00
Ioannis Glaropoulos
620cf68c04 boards: nrf5340: fix default flash partitioning
This commit fixes the default partitioning of flash
in nrf5340 Application MCU, to comply with the nRF SPU
region boundaries. To properly align the partition start
addresses with SPU requirements we modify the start of the
slot0 and slot1 partitions. This leaves some extra space
available for MCUboot, whose size is now changed from
0xc000 to 0x10000. In addition, the non-secure partition
size (slot0_nonsecure) is decreased, and as a consequence
of that we also modify the board's .yaml file to reflect
the new image size of the non-secure version of the board.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-09-18 09:58:45 -05:00
Ioannis Glaropoulos
d5c822d5c2 boards: nrf9160: fix default flash partitioning
This commit fixes the default partitioning of flash
in nrf9160 Cortex-M33 MCU, to comply with the nRF SPU
region boundaries. To properly align the partition start
addresses with SPU requirements we modify the start of the
slot0 and slot1 partitions. This leaves some extra space
available for MCUboot, whose size is now changed from
0xc000 to 0x10000. In addition, the non-secure partition
size (slot0_nonsecure) is decreased, and as a consequence
of that we also modify the board's .yaml file to reflect
the new image size of the non-secure version of the board.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-09-18 09:58:45 -05:00
Erwan Gouriou
16813844ac doc: release notes V2.4.0: Shields additions
Document Shields additions in V2.4.0 release notes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-09-18 09:35:41 -05:00
Erwan Gouriou
db97ccdb96 doc: release notes V2.4.0: STM32 related additions
Document STM32 related changes in V2.4.0 release notes.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-09-18 09:35:41 -05:00
Eugeniy Paltsev
8e1f40a632 ARC: linker: merge GNU and MWDT linker scripts
As discussed in #22668, there is additional risk ascociated with
splitting linker files, as one may update one script and not be
aware of the other. Especially related to updating GNU ld, and
not mwdt could break code for mwdt unnoticed, as mwdt is not
part of CI.

Let's create a single entry point for linker template.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-18 09:49:09 -04:00
Eugeniy Paltsev
243120da0c linker: kobject-text: align multiline string definition syntax
Align multiline string definition syntax in ASSERT in linker
script. This allows to use linker script with ASSERT provided
by linker (i.e GNU toolchain) or dummy ASSERT defined as
preprocessor macros (ARC MWDT toolchain).

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
2020-09-18 09:49:09 -04:00