xfrm: Reset secpath in xfrm failure
authorMyungho Jung <mhjungk@gmail.com>
Thu, 7 Mar 2019 01:23:08 +0000 (10:23 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2019 16:22:21 +0000 (18:22 +0200)
commit70a87327025adb6be2cf1e71ba6d215e79f95f3f
treecb08754d8434c5b524c62a599c3cef67fa547e1c
parent9531aac1ee3ee4498bde4f89df83818a1617419e
xfrm: Reset secpath in xfrm failure

[ Upstream commit 6ed69184ed9c43873b8a1ee721e3bf3c08c2c6be ]

In esp4_gro_receive() and esp6_gro_receive(), secpath can be allocated
without adding xfrm state to xvec. Then, sp->xvec[sp->len - 1] would
fail and result in dereferencing invalid pointer in esp4_gso_segment()
and esp6_gso_segment(). Reset secpath if xfrm function returns error.

Fixes: 7785bba299a8 ("esp: Add a software GRO codepath")
Reported-by: syzbot+b69368fd933c6c592f4c@syzkaller.appspotmail.com
Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/esp4_offload.c
net/ipv6/esp6_offload.c