Skip to content

Commit

Permalink
af_key: return error if pfkey_xfrm_policy2msg_prep() fails
Browse files Browse the repository at this point in the history
The original code saved the error value but just returned 0 in the end.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jamal Hadi Salim <hadi@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Mar 24, 2010
1 parent 03e6d81 commit 9a127aa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions net/key/af_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

}
Expand Down

0 comments on commit 9a127aa

Please sign in to comment.