alistair23-linux/net/dccp
Gerrit Renker 720dc34bbb dccp: fix oops on Reset after close
This fixes a bug in the order of dccp_rcv_state_process() that still permitted
reception even after closing the socket. A Reset after close thus causes a NULL
pointer dereference by not preventing operations on an already torn-down socket.

 dccp_v4_do_rcv() 
	|
	| state other than OPEN
	v
 dccp_rcv_state_process()
	|
	| DCCP_PKT_RESET
	v
 dccp_rcv_reset()
	|
	v
 dccp_time_wait()

 WARNING: at net/ipv4/inet_timewait_sock.c:141 __inet_twsk_hashdance+0x48/0x128()
 Modules linked in: arc4 ecb carl9170 rt2870sta(C) mac80211 r8712u(C) crc_ccitt ah
 [<c0038850>] (unwind_backtrace+0x0/0xec) from [<c0055364>] (warn_slowpath_common)
 [<c0055364>] (warn_slowpath_common+0x4c/0x64) from [<c0055398>] (warn_slowpath_n)
 [<c0055398>] (warn_slowpath_null+0x1c/0x24) from [<c02b72d0>] (__inet_twsk_hashd)
 [<c02b72d0>] (__inet_twsk_hashdance+0x48/0x128) from [<c031caa0>] (dccp_time_wai)
 [<c031caa0>] (dccp_time_wait+0x40/0xc8) from [<c031c15c>] (dccp_rcv_state_proces)
 [<c031c15c>] (dccp_rcv_state_process+0x120/0x538) from [<c032609c>] (dccp_v4_do_)
 [<c032609c>] (dccp_v4_do_rcv+0x11c/0x14c) from [<c0286594>] (release_sock+0xac/0)
 [<c0286594>] (release_sock+0xac/0x110) from [<c031fd34>] (dccp_close+0x28c/0x380)
 [<c031fd34>] (dccp_close+0x28c/0x380) from [<c02d9a78>] (inet_release+0x64/0x70)

The fix is by testing the socket state first. Receiving a packet in Closed state
now also produces the required "No connection" Reset reply of RFC 4340, 8.3.1.

Reported-and-tested-by: Johan Hovold <jhovold@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-03-01 23:02:07 -08:00
..
ccids dccp ccid-2: Separate option parsing from CCID processing 2010-11-15 07:12:01 +01:00
ackvec.c dccp ccid-2: whitespace fix-up 2010-11-18 09:37:07 -08:00
ackvec.h dccp ccid-2: Separate option parsing from CCID processing 2010-11-15 07:12:01 +01:00
ccid.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
ccid.h dccp: Return-value convention of hc_tx_send_packet() 2010-10-28 10:27:00 -07:00
dccp.h dccp: fix bug in updating the GSR 2011-01-07 12:22:43 +01:00
diag.c dccp_diag: LISTEN sockets don't have CCIDs 2008-12-17 16:08:01 -08:00
feat.c dccp: Kill dead code and add static markers. 2010-10-06 23:12:07 -07:00
feat.h dccp: Kill dead code and add static markers. 2010-10-06 23:12:07 -07:00
input.c dccp: fix oops on Reset after close 2011-03-01 23:02:07 -08:00
ipv4.c net: use the macros defined for the members of flowi 2010-11-17 12:27:45 -08:00
ipv6.c tproxy: fix hash locking issue when using port redirection in __inet_inherit_port() 2010-10-21 13:06:43 +02:00
ipv6.h Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
Kconfig Docs/Kconfig: Update: osdl.org -> linuxfoundation.org 2010-11-15 23:50:13 +01:00
Makefile dccp: Policy-based packet dequeueing infrastructure 2010-12-07 13:47:12 +01:00
minisocks.c dccp: fix the adjustments to AWL and SWL 2010-10-12 06:57:40 +02:00
options.c dccp ccid-2: Separate option parsing from CCID processing 2010-11-15 07:12:01 +01:00
output.c dccp: Policy-based packet dequeueing infrastructure 2010-12-07 13:47:12 +01:00
probe.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
proto.c dccp qpolicy: Parameter checking of cmsg qpolicy parameters 2010-12-07 13:47:12 +01:00
qpolicy.c dccp qpolicy: Parameter checking of cmsg qpolicy parameters 2010-12-07 13:47:12 +01:00
sysctl.c dccp: make upper bound for seq_window consistent on 32/64 bit 2011-01-07 12:22:44 +01:00
timer.c dccp: Refine the wait-for-ccid mechanism 2010-10-28 10:27:01 -07:00