/[base]
ViewVC logotype

Revision 318734


Jump to revision: Previous Next
Author: ae
Date: Tue May 23 09:01:48 2017 UTC (7 years, 1 month ago)
Changed paths: 4
Log Message:
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


Changed paths

Path Details
Directoryhead/sys/netipsec/ipsec_input.c modified , text changed
Directoryhead/sys/netipsec/xform_ah.c modified , text changed
Directoryhead/sys/netipsec/xform_esp.c modified , text changed
Directoryhead/sys/netipsec/xform_ipcomp.c modified , text changed

  ViewVC Help
Powered by ViewVC 1.1.27