Skip to content

Commit

Permalink
Merge pull request zephyrproject-rtos#13 from converge-io/david/add_n…
Browse files Browse the repository at this point in the history
…ext_fix

net: mgmt: Fix memory corruption in wait_on_iface
  • Loading branch information
davidbascelli authored Aug 2, 2024
2 parents bb47630 + 1453b23 commit 8e0624e
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions subsys/net/ip/net_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,29 +236,32 @@ static int mgmt_event_wait_call(struct net_if *iface,
net_mgmt_add_event_callback(&sync);

ret = k_sem_take(sync.sync_call, timeout);
if (ret == -EAGAIN) {
ret = -ETIMEDOUT;
} else {
if (!ret) {
if (raised_event) {
*raised_event = sync.raised_event;
}
if (ret < 0) {
if (ret == -EAGAIN) {
ret = -ETIMEDOUT;
}

if (event_iface) {
*event_iface = sync_data.iface;
}
net_mgmt_del_event_callback(&sync);
return ret;
}

if (raised_event) {
*raised_event = sync.raised_event;
}

if (event_iface) {
*event_iface = sync_data.iface;
}

#ifdef CONFIG_NET_MGMT_EVENT_INFO
if (info) {
*info = sync.info;
if (info) {
*info = sync.info;

if (info_length) {
*info_length = sync.info_length;
}
}
#endif /* CONFIG_NET_MGMT_EVENT_INFO */
if (info_length) {
*info_length = sync.info_length;
}
}
#endif /* CONFIG_NET_MGMT_EVENT_INFO */

return ret;
}
Expand Down

0 comments on commit 8e0624e

Please sign in to comment.