The buffer being returned shouldn't be enqueued as this will cause it to
be returned again on the next dequeue, by which point it may have been
freed via the returned reference.

Signed-off-by: Stuart Haslam <[email protected]>
---
(This code contribution is provided under the terms of agreement LES-LTM-21309)

 platform/linux-generic/odp_packet_io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_packet_io.c 
b/platform/linux-generic/odp_packet_io.c
index 7e3eca2..451e0f7 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -440,7 +440,9 @@ odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *qentry)
                tmp_hdr_tbl[i] = odp_buf_to_hdr(buf);
        }
 
-       queue_enq_multi(qentry, tmp_hdr_tbl, pkts);
+       if (pkts > 1)
+               queue_enq_multi(qentry, &tmp_hdr_tbl[1], pkts-1);
+
        buf_hdr = tmp_hdr_tbl[0];
        return buf_hdr;
 }
-- 
2.1.1



_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to