OSDN Git Service

xfrm: Fix error reporting in xfrm_state_construct.
authorSteffen Klassert <steffen.klassert@secunet.com>
Mon, 7 Jun 2021 13:21:49 +0000 (15:21 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 14 Jun 2021 09:58:43 +0000 (11:58 +0200)
commit6fd06963fa74197103cdbb4b494763127b3f2f34
tree1585d150c7ac714ff5c46a430f7294a07c56ab83
parenteebd49a4ffb420a991c606e54aa3c9f02857a334
xfrm: Fix error reporting in xfrm_state_construct.

When memory allocation for XFRMA_ENCAP or XFRMA_COADDR fails,
the error will not be reported because the -ENOMEM assignment
to the err variable is overwritten before. Fix this by moving
these two in front of the function so that memory allocation
failures will be reported.

Reported-by: Tobias Brunner <tobias@strongswan.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_user.c