Re: [PATCH] cdc_acm: Fix memory leak after hangup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Dienstag, 3. November 2009 11:53:07 schrieb Francesco Lavra:
> Oliver Neukum <oliver@...> writes:

> > > I was able the fix this problem with the following patch:

This version is looking good. And it is needed in mainline and stable.

	Regards
		Oliver
> > >
> > > diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> > > index 2bfc41e..0970d2f 100644
> > > --- a/drivers/usb/class/cdc-acm.c
> > > +++ b/drivers/usb/class/cdc-acm.c
> > > @@ -676,6 +676,7 @@ static void acm_tty_hangup(struct tty_struct *tty)
> > >         struct acm *acm = tty->driver_data;
> > >         tty_port_hangup(&acm->port);
> > >         acm_port_down(acm, 0);
> > > +       acm_tty_unregister(acm);
> > >  }
> >
> > Hi,
> >
> > Alan, this looks incorrect to me. Why unregister in hangup?
> >
> > 	Regards
> > 		Oliver
>
> I have the same problem with cdc-acm (I'm using a Samsung SGH-U900): when I
> unplug it from the USB port during a PPP connection, the ppp daemon gets
> the hangup correctly (and closes the device), but the struct acm
> corresponding to the device disconnected is not freed. Hence reconnecting
> the device results in creation of /dev/ttyACM(x+1). The same happens when
> the system is hibernated during a PPP connection.
> This memory leak is due to the fact that when the tty is hung up,
> tty_port_close_start() returns always zero, and acm_tty_close() never
> reaches the point where acm_tty_unregister() is called.
> Below is my proposed patch.
> Regards,
> Francesco
>
> Signed-off-by: Francesco Lavra <francescolavra@xxxxxxxxxxxx>
Acked-by: Oliver Neukum <oliver@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux