Message ID | 20181112122039.17791-1-i.maximets@samsung.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] pinctrl: Fix dp_packet structure leak. | expand |
> 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. > > CC: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > Fixes: d7abfe39cfd2 ("OVN: add buffering support for ip packets") > Signed-off-by: Ilya Maximets <i.maximets@samsung.com> > --- > ovn/controller/pinctrl.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c > index 21454ab47..56539a891 100644 > --- a/ovn/controller/pinctrl.c > +++ b/ovn/controller/pinctrl.c > @@ -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; > @@ -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; > } > @@ -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; > } > -- > 2.17.1 > Thanks for fixing it Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
On Mon, Nov 12, 2018 at 03:54:12PM +0100, Lorenzo Bianconi wrote: > > 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. > > > > CC: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> > > Fixes: d7abfe39cfd2 ("OVN: add buffering support for ip packets") > > Signed-off-by: Ilya Maximets <i.maximets@samsung.com> > > --- > > ovn/controller/pinctrl.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c > > index 21454ab47..56539a891 100644 > > --- a/ovn/controller/pinctrl.c > > +++ b/ovn/controller/pinctrl.c > > @@ -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; > > @@ -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; > > } > > @@ -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; > > } > > -- > > 2.17.1 > > > > Thanks for fixing it > > Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Thanks, Ilya and Lorenzo. Applied to master.
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 21454ab47..56539a891 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -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; @@ -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; } @@ -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; }
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. CC: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Fixes: d7abfe39cfd2 ("OVN: add buffering support for ip packets") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> --- ovn/controller/pinctrl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)