af_key: fix leaks in key_pol_get_resp and dump_sp.
authorJeremy Sowden <jeremy@azazel.net>
Sat, 25 May 2019 18:09:35 +0000 (19:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:21 +0000 (07:28 +0200)
commit08346a4850643ff42ace3a746f331fd0a7fe09b7
tree778405a98996ac99ef3daa7a3e29e96992a0cf6c
parentb49b8338c4216b79f72f626455802ce23d57a654
af_key: fix leaks in key_pol_get_resp and dump_sp.

[ Upstream commit 7c80eb1c7e2b8420477fbc998971d62a648035d9 ]

In both functions, if pfkey_xfrm_policy2msg failed we leaked the newly
allocated sk_buff.  Free it on error.

Fixes: 55569ce256ce ("Fix conversion between IPSEC_MODE_xxx and XFRM_MODE_xxx.")
Reported-by: syzbot+4f0529365f7f2208d9f0@syzkaller.appspotmail.com
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/key/af_key.c