diff options
author | Matias Elo <matias.elo@nokia.com> | 2017-05-24 17:35:19 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2017-05-25 22:37:00 +0300 |
commit | ba6cad6319b917c078dd0c20cd6b011637195898 (patch) | |
tree | da8d13b4696e5237df23dd4fcb58a0857715772f /platform/linux-generic | |
parent | c5eb1703fe9e7529ae12ecf1799b757e1a992afd (diff) |
linux-gen: packet: fix odp_packet_free_multi() with single segment pool
Previously the implementation would use wrong handles and crash if
CONFIG_PACKET_MAX_SEGS was set to one.
https://bugs.linaro.org/show_bug.cgi?id=3013
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r-- | platform/linux-generic/odp_packet.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index e99e8b837..3e7c07a35 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -594,11 +594,16 @@ void odp_packet_free(odp_packet_t pkt) void odp_packet_free_multi(const odp_packet_t pkt[], int num) { + odp_buffer_t buf[num * CONFIG_PACKET_MAX_SEGS]; + int i; + if (CONFIG_PACKET_MAX_SEGS == 1) { - buffer_free_multi((const odp_buffer_t * const)pkt, num); + for (i = 0; i < num; i++) + buf[i] = buffer_handle(packet_hdr(pkt[i])); + + buffer_free_multi(buf, num); } else { - odp_buffer_t buf[num * CONFIG_PACKET_MAX_SEGS]; - int i, j; + int j; int bufs = 0; for (i = 0; i < num; i++) { |