Skip to contentSkip to conversation

colo-compare: Fix memory leak for non-tcp packet

PATCH Applied Lukas Straub 3 participants 10 messages Nov 15, 2020 – Mar 18, 2021 Networking

lore
Share & tools
lore
#0 lore raw

cover colo-compare: Fix memory leak for non-tcp packet

Hello Everyone,
This fixes a memory leak for non-tcp packets and optimizes the removal from the queue.

Lukas Straub (2):
net/colo-compare.c: Fix memory leak for non-tcp packet net/colo-compare.c: Optimize removal of secondary packet

 net/colo-compare.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1

#1 lore raw

PATCH 1/2 net/colo-compare.c: Fix memory leak for non-tcp packet

Additional to removing the packet from the secondary queue, we also need to free it.

---
 net/colo-compare.c | 1 +
 1 file changed, 1 insertion(+)
net/colo-compare.c +1 -0
index 337025b44f..eed0fbb27b 100644
@@ -690,6 +690,7 @@ static void colo_compare_packet(CompareState *s, Connection *conn,
 
         if (result) {
             colo_release_primary_pkt(s, pkt);
+            packet_destroy(result->data, NULL);
             g_queue_remove(&conn->secondary_list, result->data);
         } else {
             /*

--
2.20.1

#3 lore raw

PATCH 2/2 net/colo-compare.c: Optimize removal of secondary packet

In reply to Lukas Straub

g_queue_remove needs to look up the list entry first, but we already have it as result and can remove it directly with g_queue_delete_link.

---
 net/colo-compare.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/colo-compare.c +1 -1
index eed0fbb27b..4e2af8ff00 100644
@@ -691,7 +691,7 @@ static void colo_compare_packet(CompareState *s, Connection *conn,
         if (result) {
             colo_release_primary_pkt(s, pkt);
             packet_destroy(result->data, NULL);
-            g_queue_remove(&conn->secondary_list, result->data);
+            g_queue_delete_link(&conn->secondary_list, result);
         } else {
             /*
              * If one packet arrive late, the secondary_list or

--
2.20.1

Reviewed-by on v1 1/2
#2 lore raw

RE: [PATCH 1/2] net/colo-compare.c: Fix memory leak for non-tcp packet

In reply to Lukas Straub
Quoted 11 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Sunday, November 15, 2020 7:19 PM
To: qemu-devel <[email protected]>
Cc: Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 1/2] net/colo-compare.c: Fix memory leak for non-tcp packet

Quoted 4 lines

Additional to removing the packet from the secondary queue, we also need to free it.

Looks good to me.

Thanks
Chen

Quoted 19 lines
---
 net/colo-compare.c | 1 +
 1 file changed, 1 insertion(+)
net/colo-compare.c index renamed from net/colo-compare.c +0 -0

337025b44f..eed0fbb27b 100644

net/colo-compare.c +1 -0
@@ -690,6 +690,7 @@ static void colo_compare_packet(CompareState *s,
 Connection *conn,
 
         if (result) {
             colo_release_primary_pkt(s, pkt);
+            packet_destroy(result->data, NULL);
             g_queue_remove(&conn->secondary_list, result->data);
         } else {
             /*

--
2.20.1

Reviewed-by on v1 2/2
#4 lore raw

RE: [PATCH 2/2] net/colo-compare.c: Optimize removal of secondary packet

In reply to Lukas Straub
Quoted 11 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Sunday, November 15, 2020 7:19 PM
To: qemu-devel <[email protected]>
Cc: Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 2/2] net/colo-compare.c: Optimize removal of secondary packet

Quoted 4 lines

g_queue_remove needs to look up the list entry first, but we already have it as result and can remove it directly with g_queue_delete_link.

Thanks
Chen

Quoted 20 lines
---
 net/colo-compare.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/colo-compare.c index renamed from net/colo-compare.c +0 -0

eed0fbb27b..4e2af8ff00 100644

net/colo-compare.c +1 -1
@@ -691,7 +691,7 @@ static void colo_compare_packet(CompareState *s,
 Connection *conn,
         if (result) {
             colo_release_primary_pkt(s, pkt);
             packet_destroy(result->data, NULL);
-            g_queue_remove(&conn->secondary_list, result->data);
+            g_queue_delete_link(&conn->secondary_list, result);
         } else {
             /*

* If one packet arrive late, the secondary_list or
--
2.20.1

Applied
#5 lore raw
In reply to Lukas Straub

Queued this series to COLO tree.

Thanks
Chen

Quoted 21 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Sunday, November 15, 2020 7:19 PM
To: qemu-devel <[email protected]>
Cc: Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hello Everyone,
This fixes a memory leak for non-tcp packets and optimizes the removal from the queue.

Lukas Straub (2):
net/colo-compare.c: Fix memory leak for non-tcp packet net/colo-compare.c: Optimize removal of secondary packet

 net/colo-compare.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1

#6 lore raw

Hi,
This hasn't been merged yet.

Regards,
Lukas Straub

Quoted 26 lines · Chen

Queued this series to COLO tree.

Thanks
Chen

Quoted 21 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Sunday, November 15, 2020 7:19 PM
To: qemu-devel <[email protected]>
Cc: Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hello Everyone,
This fixes a memory leak for non-tcp packets and optimizes the removal from the queue.

Lukas Straub (2):
net/colo-compare.c: Fix memory leak for non-tcp packet net/colo-compare.c: Optimize removal of secondary packet

 net/colo-compare.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1

#7 lore raw

Sorry for the delay. Current COLO tree just merged this series,
I originally wanted to merge other COLO related patches(Lei or me) and submit it together to Jason.

Hi Jason, do you need me to send this series first or do you want to do it together?

Thanks
Chen

Quoted 48 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Thursday, March 18, 2021 5:24 AM
To: Zhang, Chen <[email protected]>
Cc: qemu-devel <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: Re: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hi,
This hasn't been merged yet.

Regards,
Lukas Straub

Quoted 27 lines · Chen

Queued this series to COLO tree.

Thanks
Chen

Quoted 22 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Sunday, November 15, 2020 7:19 PM
To: qemu-devel <[email protected]>
Cc: Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hello Everyone,
This fixes a memory leak for non-tcp packets and optimizes the removal from the queue.

Lukas Straub (2):
net/colo-compare.c: Fix memory leak for non-tcp packet net/colo-compare.c: Optimize removal of secondary packet

 net/colo-compare.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1

--

#8 lore raw
Quoted 4 lines · Chen

Sorry for the delay. Current COLO tree just merged this series,
I originally wanted to merge other COLO related patches(Lei or me) and submit it together to Jason.

Hi Jason, do you need me to send this series first or do you want to do it together?

We're in soft freeze, so if you can collect all the patches before hard free, that would be better.

Thanks

Quoted 51 lines

Thanks
Chen

Quoted 47 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Thursday, March 18, 2021 5:24 AM
To: Zhang, Chen <[email protected]>
Cc: qemu-devel <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: Re: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hi,
This hasn't been merged yet.

Regards,
Lukas Straub

Quoted 27 lines · Chen

Queued this series to COLO tree.

Thanks
Chen

Quoted 22 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Sunday, November 15, 2020 7:19 PM
To: qemu-devel <[email protected]>
Cc: Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hello Everyone,
This fixes a memory leak for non-tcp packets and optimizes the removal from the queue.

Lukas Straub (2):
net/colo-compare.c: Fix memory leak for non-tcp packet net/colo-compare.c: Optimize removal of secondary packet

  net/colo-compare.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1

--

#9 lore raw
Quoted 15 lines

-----Original Message-----
From: Jason Wang <[email protected]>
Sent: Thursday, March 18, 2021 10:41 AM
To: Zhang, Chen <[email protected]>; Lukas Straub <[email protected]>
Cc: qemu-devel <[email protected]>; Li Zhijian <[email protected]>
Subject: Re: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Quoted 2 lines · Chen

Sorry for the delay. Current COLO tree just merged this series, I originally wanted to merge other COLO related patches(Lei or me) and

Quoted 9 lines

submit it together to Jason.

Quoted 2 lines

Hi Jason, do you need me to send this series first or do you want to do it

together?

We're in soft freeze, so if you can collect all the patches before hard free, that would be better.

OK, I will send this series first.

Thanks
Chen

Quoted 55 lines

Thanks

Quoted 52 lines

Thanks
Chen

Quoted 48 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Thursday, March 18, 2021 5:24 AM
To: Zhang, Chen <[email protected]>
Cc: qemu-devel <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: Re: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hi,
This hasn't been merged yet.

Regards,
Lukas Straub

Quoted 27 lines · Chen

Queued this series to COLO tree.

Thanks
Chen

Quoted 22 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Sunday, November 15, 2020 7:19 PM
To: qemu-devel <[email protected]>
Cc: Zhang, Chen <[email protected]>; Li Zhijian <[email protected]>; Jason Wang <[email protected]>
Subject: [PATCH 0/2] colo-compare: Fix memory leak for non-tcp packet

Hello Everyone,
This fixes a memory leak for non-tcp packets and optimizes the removal from the queue.

Lukas Straub (2):
net/colo-compare.c: Fix memory leak for non-tcp packet net/colo-compare.c: Optimize removal of secondary packet

  net/colo-compare.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

--
2.20.1

--