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

From: Peilin Ye
Date: Mon Aug 08 2022 - 13:47:48 EST


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:
> > 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@xxxxxxxxxx>

Thanks!

Peilin Ye