[PATCH] serial-port: fail open/reopen after a serial port is disposed
Ben Chan
benchan at chromium.org
Wed Jan 8 10:14:18 PST 2014
>
>
> > I examined the references of the port and they all seemed ok. The actual
> > issue may be the following:
> >
> > 1. data_available() calls mm_serial_port_close_force() to force close a
> > port upon receiving G_IO_HUP. priv->forced_close is set to TRUE.
> > 2. The connection/disconnection sequence still holds a reference to the
> > port and eventually triggers the port to be re-opened. However,
> > mm_serial_port_open() doesn't reset priv->forced_close to FALSE.
> > 3. When the port is no longer referenced, dispose() calls
> > mm_serial_port_close_force(), which does nothing because
> priv->forced_close
> > is TRUE.
> > 4. priv->watch_id is still active and eventually calls data_available()
> > after the port is finalized. data_available() accesses priv->queue and
> > crashes.
> >
> > We can either (1) reset priv->forced_close to FALSE in
> mm_serial_port_open,
> > or (2) fail open/repoen if priv->forced_close is TRUE. (1) assumes it's
> ok
> > to repoen a force-closed port while (2) doesn't. Dan / Aleksander, which
> > semantic do you prefer?
> >
>
> Forced-close is done only when the port gets removed (i.e. we get a
> HUP); so I'd suggest to go for option #2 (i.e. error if trying to reopen
> a forced-closed port).
>
Sounds good to me. I've submitted a new patch to do that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/modemmanager-devel/attachments/20140108/e367f9ed/attachment.html>
More information about the ModemManager-devel
mailing list