Skip to content

tests/net/ieee802154/l2 uses semaphore before initialization #3753

@zephyrbot

Description

@zephyrbot

Reported by Andrew Boie:

I found this when testing some experimental code to show that kernel objects have been properly initialized.

In this particular test, the "driver_lock" semaphore gets initialized in the initialize_test_environment() function.

However, a network stack thread is attempting to give this semaphore before initialization can take place:

<span>#</span>0  _k_object_validate (obj=0x1119c8 <driver_lock>, otype=K_OBJ_SEM)
    at /projects/zephyr/kernel/object_validate.c:145
<span>#</span>1  0x0010e33a in k_sem_give (sem=0x1119c8 <driver_lock>) at /projects/zephyr/kernel/sem.c:135
<span>#</span>2  0x001008f2 in fake_tx (dev=0x11104c <__device_fake>, pkt=0x113480 <_k_mem_slab_buf_tx_pkts+256>, 
    frag=0x1128d0 <_net_buf_tx_bufs+144>)
    at /projects/zephyr/tests/net/ieee802154/l2/src/ieee802154_fake_driver.c:93
<span>#</span>3  0x00105582 in csma_ca_tx_fragment (iface=0x111140 <__net_if_fake_0>, 
    pkt=0x113480 <_k_mem_slab_buf_tx_pkts+256>, frag=0x1128d0 <_net_buf_tx_bufs+144>)
    at /projects/zephyr/subsys/net/ip/l2/ieee802154/ieee802154_radio_csma_ca.c:64
<span>#</span>4  0x00105612 in tx_packet_fragments (tx_func=0x10546d <csma_ca_tx_fragment>, 
    pkt=0x113480 <_k_mem_slab_buf_tx_pkts+256>, iface=0x111140 <__net_if_fake_0>)
    at /projects/zephyr/subsys/net/ip/l2/ieee802154/ieee802154_radio_utils.h:67
<span>#</span>5  csma_ca_radio_send (iface=0x111140 <__net_if_fake_0>, pkt=0x113480 <_k_mem_slab_buf_tx_pkts+256>)
    at /projects/zephyr/subsys/net/ip/l2/ieee802154/ieee802154_radio_csma_ca.c:82
<span>#</span>6  0x00103022 in net_if_tx (iface=0x111140 <__net_if_fake_0>)
    at /projects/zephyr/subsys/net/ip/net_if.c:111
<span>#</span>7  0x0010306a in net_if_process_events (event=0x111340 <__net_if_event_fake_0>, 
    ev_count=ev_count@entry=1) at /projects/zephyr/subsys/net/ip/net_if.c:171
<span>#</span>8  0x001030a8 in net_if_tx_thread (startup_sync=0x1110d8 <startup_sync>)
    at /projects/zephyr/subsys/net/ip/net_if.c:214
<span>#</span>9  0x0010e87c in _thread_entry (entry=0x103072 <net_if_tx_thread>, p1=0x1110d8 <startup_sync>, 
    p2=0x0, p3=0x0) at /projects/zephyr/kernel/thread.c:186
<span>#</span>10 0x00000202 in ?? ()

(Imported from Jira ZEP-2319)

Metadata

Metadata

Assignees

Labels

area: NetworkingbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions