summaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorJiasheng Jiang <jiasheng@iscas.ac.cn>2022-05-17 17:42:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-25 09:10:40 +0200
commit2bc70aeba57f173f864c6fccdd13d53a1daa9c51 (patch)
treea0d9f5b6ff7594397e77966e1454904b40f4ac06 /net/key
parente2b5e3844310ba1492c14b8f4b762afc3ca3348e (diff)
downloadlinux-stable-2bc70aeba57f173f864c6fccdd13d53a1daa9c51.tar.gz
linux-stable-2bc70aeba57f173f864c6fccdd13d53a1daa9c51.tar.bz2
linux-stable-2bc70aeba57f173f864c6fccdd13d53a1daa9c51.zip
net: af_key: add check for pfkey_broadcast in function pfkey_process
[ Upstream commit 4dc2a5a8f6754492180741facf2a8787f2c415d7 ] If skb_clone() returns null pointer, pfkey_broadcast() will return error. Therefore, it should be better to check the return value of pfkey_broadcast() and return error if fails. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a416c0f90056..170960ef7e36 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2836,8 +2836,10 @@ static int pfkey_process(struct sock *sk, struct sk_buff *skb, const struct sadb
void *ext_hdrs[SADB_EXT_MAX];
int err;
- pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
- BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
+ err = pfkey_broadcast(skb_clone(skb, GFP_KERNEL), GFP_KERNEL,
+ BROADCAST_PROMISC_ONLY, NULL, sock_net(sk));
+ if (err)
+ return err;
memset(ext_hdrs, 0, sizeof(ext_hdrs));
err = parse_exthdrs(skb, hdr, ext_hdrs);