Hi Marcel, On Wed, Sep 7, 2011 at 3:46 PM, Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote: > Hi Luiz, > >> > yes, you do have to keep track of the client. You wanna do a proper >> > shutdown if the client exits unexpectedly. Or forgets to call shutdown. >> >> I guess the kernel would auto release the socket if the process exit >> and nobody else has a reference to it, so if we close our fd after it >> has been transferred the only one with reference is the client, iirc >> this was a problem to tty because we have to release the devnode to >> disconnect which involves ioctl but afaik that is not the case for >> sockets and the client can basically call close and be done with it, >> right? > > does dbus-daemon holds the reference for the time of D-Bus message to be > in flight between bluetoothd and the client? If not, then we have a race > condition here, because we dropped the reference before it ended up on > the other side. Good question, iirc dbus-daemon does use dup but we better confirm with Lennart how this is supposed to work. Anyway if it doesn't then I guess it should be fixed in dbus-daemon to do it, otherwise as you said it will be racy to transfer fd specially when fd is send in a reply. -- Luiz Augusto von Dentz -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html