Skip to content

Commit

Permalink
pinctrl: Fix dp_packet structure leak.
Browse files Browse the repository at this point in the history
Buffered packets are always packets created by 'dp_packet_clone_data()'
i.e. they are malloced. It's not enough to free the packet data,
dp_packet structure must be freed too. 'dp_packet_delete()' will take
care of that.

Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Fixes: d7abfe3 ("OVN: add buffering support for ip packets")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
igsilya authored and blp committed Nov 12, 2018
1 parent 0f582e4 commit 2b20cc5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ovn/controller/pinctrl.c
Expand Up @@ -229,7 +229,7 @@ destroy_buffered_packets(struct buffered_packets *bp)

while (bp->head != bp->tail) {
bi = &bp->data[bp->head];
dp_packet_uninit(bi->p);
dp_packet_delete(bi->p);
ofpbuf_uninit(&bi->ofpacts);

bp->head = (bp->head + 1) % BUFFER_QUEUE_DEPTH;
Expand Down Expand Up @@ -267,7 +267,7 @@ buffered_push_packet(struct buffered_packets *bp,

if (next == bp->head) {
bi = &bp->data[bp->head];
dp_packet_uninit(bi->p);
dp_packet_delete(bi->p);
ofpbuf_uninit(&bi->ofpacts);
bp->head = (bp->head + 1) % BUFFER_QUEUE_DEPTH;
}
Expand Down Expand Up @@ -296,7 +296,7 @@ buffered_send_packets(struct buffered_packets *bp, struct eth_addr *addr)
queue_msg(ofputil_encode_packet_out(&po, proto));

ofpbuf_uninit(&bi->ofpacts);
dp_packet_uninit(bi->p);
dp_packet_delete(bi->p);

bp->head = (bp->head + 1) % BUFFER_QUEUE_DEPTH;
}
Expand Down

0 comments on commit 2b20cc5

Please sign in to comment.