freebsd-skq/sys/netipsec
Andrey V. Elsukov 5f7c516f21 Fix possible double releasing for SA reference.
There are two possible ways how crypto callback are called: directly from
caller and deffered from crypto thread.

For inbound packets the direct call chain is the following:
 IPSEC_INPUT() method -> ipsec_common_input() -> xform_input() ->
 -> crypto_dispatch() -> crypto_invoke() -> crypto_done() ->
 -> xform_input_cb() -> ipsec[46]_common_input_cb() -> netisr_queue().

The SA reference is held while crypto processing is not finished.
The error handling code wrongly expected that crypto callback always called
from the crypto thread context, and it did SA reference releasing in
xform_input_cb(). But when the crypto callback called directly, in case of
error (e.g. data authentification failed) the error handling in
ipsec_common_input() also did SA reference releasing.

To fix this, remove error handling from ipsec_common_input() and do it
in xform_input() before crypto_dispatch().

PR:		219356
MFC after:	10 days
2017-05-23 09:01:48 +00:00
..
ah_var.h
ah.h
esp_var.h
esp.h Summary: Remove spurious, extra, next header comments. 2015-05-15 18:04:49 +00:00
ipcomp_var.h
ipcomp.h
ipsec6.h Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ipsec_input.c Fix possible double releasing for SA reference. 2017-05-23 09:01:48 +00:00
ipsec_mbuf.c Remove register keyword from sys/ and ANSIfy prototypes 2017-05-17 00:34:34 +00:00
ipsec_mod.c Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ipsec_output.c Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ipsec_pcb.c Fix SP refcount leak. 2017-04-26 00:34:05 +00:00
ipsec_support.h Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ipsec.c Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ipsec.h Introduce the concept of IPsec security policies scope. 2017-03-07 00:13:53 +00:00
key_debug.c Add large replay widow support to setkey(8) and libipsec. 2017-04-13 14:44:17 +00:00
key_debug.h Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
key_var.h
key.c When we are doing SA lookup for TCP-MD5, check both source and 2017-04-04 13:41:50 +00:00
key.h Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
keydb.h GC some unused declarations. 2017-04-03 04:44:56 +00:00
keysock.c Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
keysock.h Remove __P() macro. 2014-12-03 04:08:41 +00:00
subr_ipsec.c Fix LINT build for powerpc. 2017-02-16 11:38:50 +00:00
udpencap.c For translated packets do not adjust UDP checksum if it is zero. 2017-02-18 19:53:37 +00:00
xform_ah.c Fix possible double releasing for SA reference. 2017-05-23 09:01:48 +00:00
xform_esp.c Fix possible double releasing for SA reference. 2017-05-23 09:01:48 +00:00
xform_ipcomp.c Fix possible double releasing for SA reference. 2017-05-23 09:01:48 +00:00
xform_tcp.c Move tcp_fields_to_net() static inline into tcp_var.h, just below its 2017-02-10 17:46:26 +00:00
xform.h Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00