Miklos Szeredi 6209344f5a net: unix: fix inflight counting bug in garbage collector
Previously I assumed that the receive queues of candidates don't
change during the GC.  This is only half true, nothing can be received
from the queues (see comment in unix_gc()), but buffers could be added
through the other half of the socket pair, which may still have file
descriptors referring to it.

This can result in inc_inflight_move_tail() erronously increasing the
"inflight" counter for a unix socket for which dec_inflight() wasn't
previously called.  This in turn can trigger the "BUG_ON(total_refs <
inflight_refs)" in a later garbage collection run.

Fix this by only manipulating the "inflight" counter for sockets which
are candidates themselves.  Duplicating the file references in
unix_attach_fds() is also needed to prevent a socket becoming a
candidate for GC while the skb that contains it is not yet queued.

Reported-by: Andrea Bittau <a.bittau@cs.ucl.ac.uk>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-11-09 11:17:33 -08:00
..
2008-10-22 18:54:47 -05:00
2008-09-12 16:30:20 -07:00
2007-10-10 16:53:56 -07:00
2008-09-24 16:18:00 -04:00
2008-08-04 23:04:08 -07:00
2008-07-05 21:26:57 -07:00
2008-06-11 21:00:38 -07:00
2008-06-11 21:00:38 -07:00
2008-10-16 11:21:47 -07:00
2008-06-11 21:00:38 -07:00
2008-02-29 11:46:17 -08:00
2008-03-28 16:28:36 -07:00
2008-10-27 17:46:11 -04:00
2008-10-16 11:21:47 -07:00
2008-06-11 21:00:38 -07:00
2008-10-30 23:54:35 -07:00
2008-07-05 21:25:39 -07:00
2008-10-07 14:18:42 -07:00
2008-10-07 14:50:06 -07:00
2008-09-24 16:18:00 -04:00