Skip to content

Commit

Permalink
linux-gen: pktio: fix lso packet alloc error handling
Browse files Browse the repository at this point in the history
_odp_lso_create_packets() crashes currently with a segmentation fault if
odp_packet_alloc_multi() returns zero or a negative value. Fix this by
selecting error path always after alloc failure.

Signed-off-by: Matias Elo <[email protected]>
Reviewed-by: Tuomas Taipale <[email protected]>
  • Loading branch information
MatiasElo committed Oct 17, 2024
1 parent fd7b710 commit 2995872
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions platform/linux-generic/odp_packet_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3134,10 +3134,9 @@ int _odp_lso_create_packets(odp_packet_t packet, const odp_packet_lso_opt_t *lso
num = odp_packet_alloc_multi(pool, pkt_len, pkt_out, num_full);
if (odp_unlikely(num < num_full)) {
_ODP_DBG("Alloc failed %i\n", num);
if (num > 0) {
if (num > 0)
num_free = num;
goto error;
}
goto error;
}

if (left_over_len) {
Expand Down

0 comments on commit 2995872

Please sign in to comment.