Re: [Linux-ATM-General] RX/close vcc race with solos/atmtcp/usbatm/he
From: Chas Williams (CONTRACTOR) <hidden>
Date: 2010-06-07 13:50:07
In message [ref],David Woodhouse writes:
The problem is that the 'find_vcc' functions in these drivers are returning a vcc with the ATM_VF_READY bit cleared, because it's already in the process of being destroyed. If we fix that simple oversight, there's still a race condition because the socket can still be closed (and completely freed, afaict) between our call to find_vcc() and our call to vcc->push() in the RX tasklet.
...
Can anyone see a better approach -- short of rewriting the whole ATM layer to make the locking saner?
vcc's are really sockets, so you could just increase the refcount -- sock_hold(). after you push the packet, drop the refcount, sock_put() and hopefully things will be well. however, i think the close routines dont really expect this behavior so the card driver's vcc close might need to be changed to wait around if the refcount on the vcc is > 1. or perhaps the driver independent part needs to do this. the he driver works around this issue by holding vcc_sklist_lock around the find_vcc and ->push() which happen to occur in the same tasklet.