Skip to content

Commit

Permalink
net: ip: icmp: Cleanup packet on failed priority check
Browse files Browse the repository at this point in the history
A network memory leak would occur if the priority check fails.

Signed-off-by: Pieter De Gendt <[email protected]>
  • Loading branch information
pdgendt authored and carlescufi committed Nov 27, 2023
1 parent 411731f commit 473cc03
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions subsys/net/ip/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ static int send_icmpv4_echo_request(struct net_icmp_ctx *ctx,
params->priority >= NET_MAX_PRIORITIES) {
NET_ERR("Priority %d is too large, maximum allowed is %d",
params->priority, NET_MAX_PRIORITIES - 1);
return -EINVAL;
ret = -EINVAL;
goto drop;
}

if (params->priority < 0) {
Expand Down Expand Up @@ -269,7 +270,8 @@ static int send_icmpv6_echo_request(struct net_icmp_ctx *ctx,
params->priority >= NET_MAX_PRIORITIES) {
NET_ERR("Priority %d is too large, maximum allowed is %d",
params->priority, NET_MAX_PRIORITIES - 1);
return -EINVAL;
ret = -EINVAL;
goto drop;
}

if (params->priority < 0) {
Expand Down

0 comments on commit 473cc03

Please sign in to comment.