Commit 9a127aad4d60968fba96622008ea0d243688f2b0

Authored by Dan Carpenter
Committed by David S. Miller
1 parent 03e6d819c2

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: Dan Carpenter <error27@gmail.com>
Acked-by: Jamal Hadi Salim <hadi@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 5 deletions Side-by-side Diff

... ... @@ -2129,10 +2129,9 @@
2129 2129 int err;
2130 2130  
2131 2131 out_skb = pfkey_xfrm_policy2msg_prep(xp);
2132   - if (IS_ERR(out_skb)) {
2133   - err = PTR_ERR(out_skb);
2134   - goto out;
2135   - }
  2132 + if (IS_ERR(out_skb))
  2133 + return PTR_ERR(out_skb);
  2134 +
2136 2135 err = pfkey_xfrm_policy2msg(out_skb, xp, dir);
2137 2136 if (err < 0)
2138 2137 return err;
... ... @@ -2148,7 +2147,6 @@
2148 2147 out_hdr->sadb_msg_seq = c->seq;
2149 2148 out_hdr->sadb_msg_pid = c->pid;
2150 2149 pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp));
2151   -out:
2152 2150 return 0;
2153 2151  
2154 2152 }