Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2bc70aeb authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Greg Kroah-Hartman
Browse files

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: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e2b5e384
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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,
	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);