Thread (13 messages) flat view 13 messages, 3 authors, 2022-08-10

Re: [PATCH net v2 1/2] vsock: Fix memory leak in vsock_connect()

From: Peilin Ye <hidden>
Date: 2022-08-08 17:47:47
Also in: lkml

On Mon, Aug 08, 2022 at 09:55:33AM +0200, Stefano Garzarella wrote:
On Sun, Aug 07, 2022 at 02:00:11AM -0700, Peilin Ye wrote:
quoted
net/vmw_vsock/af_vsock.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index f04abf662ec6..fe14f6cbca22 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1391,7 +1391,13 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr,
			 * timeout fires.
			 */
			sock_hold(sk);
-			schedule_delayed_work(&vsk->connect_work, timeout);
+
+			/* If the timeout function is already scheduled,
+			 * reschedule it, then ungrab the socket refcount to
+			 * keep it balanced.
+			 */
+			if (mod_delayed_work(system_wq, &vsk->connect_work, timeout))
                            ^
Checkpatch warns here about line lenght.
If you have to re-send, please split it.
Oh, net-next HEAD's checkpatch --strict didn't complain, I didn't know
Patchwork checks 80 columns.  I will send v3 soon.
Anyway, the patch LGTM:

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Thanks!

Peilin Ye
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help