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

Commit 9a127aad authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller
Browse files

af_key: return error if pfkey_xfrm_policy2msg_prep() fails



The original code saved the error value but just returned 0 in the end.

Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarJamal Hadi Salim <hadi@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 03e6d819
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -2129,10 +2129,9 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
	int err;

	out_skb = pfkey_xfrm_policy2msg_prep(xp);
	if (IS_ERR(out_skb)) {
		err = PTR_ERR(out_skb);
		goto out;
	}
	if (IS_ERR(out_skb))
		return PTR_ERR(out_skb);

	err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
	if (err < 0)
		return err;
@@ -2148,7 +2147,6 @@ static int key_notify_policy(struct xfrm_policy *xp, int dir, struct km_event *c
	out_hdr->sadb_msg_seq = c->seq;
	out_hdr->sadb_msg_pid = c->pid;
	pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp));
out:
	return 0;

}