linux/net
NeilBrown 7df3fe5e2f sunrpc: prevent use-after-free on clearing XPT_BUSY
commit ed2849d3ec upstream.

When an xprt is created, it has a refcount of 1, and XPT_BUSY is set.
The refcount is *not* owned by the thread that created the xprt
(as is clear from the fact that creators never put the reference).
Rather, it is owned by the absence of XPT_DEAD.  Once XPT_DEAD is set,
(And XPT_BUSY is clear) that initial reference is dropped and the xprt
can be freed.

So when a creator clears XPT_BUSY it is dropping its only reference and
so must not touch the xprt again.

However svc_recv, after calling ->xpo_accept (and so getting an XPT_BUSY
reference on a new xprt), calls svc_xprt_recieved.  This clears
XPT_BUSY and then svc_xprt_enqueue - this last without owning a reference.
This is dangerous and has been seen to leave svc_xprt_enqueue working
with an xprt containing garbage.

So we need to hold an extra counted reference over that call to
svc_xprt_received.

For safety, any time we clear XPT_BUSY and then use the xprt again, we
first get a reference, and the put it again afterwards.

Note that svc_close_all does not need this extra protection as there are
no threads running, and the final free can only be called asynchronously
from such a thread.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-07 14:43:05 -08:00
..
9p 9p: strlen() doesn't count the terminator 2010-08-10 10:20:39 -07:00
802
8021q vlan: Fix register_vlan_dev() error path 2009-11-17 06:45:04 -08:00
appletalk
atm
ax25 ax25: netrom: rose: Fix timer oopses 2010-02-09 04:50:56 -08:00
bluetooth Bluetooth: Fix kernel crash on L2CAP stress tests 2010-04-01 15:58:55 -07:00
bridge bridge: Clear INET control block of SKBs passed into ip_fragment(). 2010-09-26 17:21:19 -07:00
can can-bcm: fix minor heap overflow 2010-12-09 13:27:10 -08:00
core net: Limit socket I/O iovec total length to INT_MAX. 2010-12-09 13:27:13 -08:00
dcb
dccp dccp_probe: Fix module load dependencies between dccp and dccp_probe 2010-05-12 14:57:11 -07:00
decnet DECnet: don't leak uninitialized stack byte 2010-12-09 13:27:03 -08:00
dsa
econet econet: fix CVE-2010-3850 2010-12-09 13:27:12 -08:00
ethernet
ieee802154
ipv4 Limit sysctl_tcp_mem and sysctl_udp_mem initializers to prevent integer overflows. 2010-12-09 13:27:06 -08:00
ipv6 ip: fix truesize mismatch in ip fragmentation 2010-10-28 21:44:08 -07:00
ipx
irda irda: Fix heap memory corruption in iriap.c 2010-12-09 13:26:32 -08:00
iucv
key
lapb
llc net/llc: make opt unsigned in llc_ui_setsockopt() 2010-09-26 17:21:24 -07:00
mac80211 mac80211: fix supported rates IE if AP doesn't give us it's rates 2010-08-02 10:21:27 -07:00
netfilter netfilter: nf_conntrack: allow nf_ct_alloc_hashtable() to get highmem pages 2010-12-09 13:26:51 -08:00
netlabel
netlink netlink: fix compat recvmsg 2010-08-26 16:41:55 -07:00
netrom ax25: netrom: rose: Fix timer oopses 2010-02-09 04:50:56 -08:00
packet af_packet: Don't use skb after dev_queue_xmit() 2010-02-09 04:50:56 -08:00
phonet Phonet: disable network namespace support 2010-10-28 21:44:17 -07:00
rds rds: Integer overflow in RDS cmsg handling 2010-12-09 13:27:12 -08:00
rfkill Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 2009-11-23 14:01:47 -08:00
rose rose: Fix signedness issues wrt. digi count. 2010-10-28 21:44:10 -07:00
rxrpc
sched net sched: fix some kernel memory leaks 2010-12-09 13:27:14 -08:00
sctp Limit sysctl_tcp_mem and sysctl_udp_mem initializers to prevent integer overflows. 2010-12-09 13:27:06 -08:00
sunrpc sunrpc: prevent use-after-free on clearing XPT_BUSY 2011-01-07 14:43:05 -08:00
tipc tipc: Fix oops on send prior to entering networked mode (v3) 2010-07-05 11:11:16 -07:00
unix UNIX: Do not loop forever at unix_autobind(). 2010-09-26 17:21:21 -07:00
wanrouter
wimax
wireless wext: fix potential private ioctl memory content leak 2010-10-28 21:44:02 -07:00
x25 x25: Prevent crashing when parsing bad X.25 facilities 2010-12-09 13:27:10 -08:00
xfrm
compat.c net: Limit socket I/O iovec total length to INT_MAX. 2010-12-09 13:27:13 -08:00
Kconfig
Makefile
nonet.c
socket.c net: Truncate recvfrom and sendto length to INT_MAX. 2010-12-09 13:27:12 -08:00
sysctl_net.c
TUNABLE