diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-05-17 12:42:31 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-25 10:14:36 +0300 |
commit | 1b93631c77c9b18cf411eafa86e0f42934da84b4 (patch) | |
tree | c5b6bc9e4a6368af88b8fd4a4bff9f9d2381154f /net | |
parent | c0be5fec786b5aab3f5db222b28a64d0946d6658 (diff) | |
download | linux-1b93631c77c9b18cf411eafa86e0f42934da84b4.tar.xz |
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')
-rw-r--r-- | net/key/af_key.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c index 2ac9560020f9..f67d3ba72c49 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -2830,8 +2830,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); |