Skip to content

Commit ebf56ed

Browse files
rveerama1jukkar
authored andcommitted
net: mgmt: Fix mgmt push event
Do not even consider the push event if CONFIG_NET_MGMT_EVENT_INFO enabled and info length is more than NET_EVENT_INFO_MAX_SIZE. Print error message and ignore the event. Signed-off-by: Ravi kumar Veeramally <[email protected]>
1 parent 731c751 commit ebf56ed

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

subsys/net/ip/net_mgmt.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ static u16_t out_event;
4646
static inline void mgmt_push_event(u32_t mgmt_event, struct net_if *iface,
4747
void *info, size_t length)
4848
{
49-
events[in_event].event = mgmt_event;
50-
events[in_event].iface = iface;
51-
5249
#ifdef CONFIG_NET_MGMT_EVENT_INFO
5350
/* Let's put the info length to 0 by default as it will be the most
5451
* common case. Also, it makes code a bit cleaner below as there is
@@ -63,6 +60,7 @@ static inline void mgmt_push_event(u32_t mgmt_event, struct net_if *iface,
6360
} else {
6461
NET_ERR("Event info length %u > max size %u",
6562
length, NET_EVENT_INFO_MAX_SIZE);
63+
return;
6664
}
6765
}
6866

@@ -71,6 +69,9 @@ static inline void mgmt_push_event(u32_t mgmt_event, struct net_if *iface,
7169
ARG_UNUSED(length);
7270
#endif /* CONFIG_NET_MGMT_EVENT_INFO */
7371

72+
events[in_event].event = mgmt_event;
73+
events[in_event].iface = iface;
74+
7475
in_event++;
7576

7677
if (in_event == CONFIG_NET_MGMT_EVENT_QUEUE_SIZE) {

0 commit comments

Comments
 (0)