aboutsummaryrefslogtreecommitdiffstats
path: root/net/key/af_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/key/af_key.c')
-rw-r--r--net/key/af_key.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 4879743b945a..bbf0f69181ba 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -185,7 +185,7 @@ static int pfkey_release(struct socket *sock)
185} 185}
186 186
187static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, 187static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
188 int allocation, struct sock *sk) 188 unsigned int __nocast allocation, struct sock *sk)
189{ 189{
190 int err = -ENOBUFS; 190 int err = -ENOBUFS;
191 191
@@ -217,7 +217,7 @@ static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2,
217#define BROADCAST_ONE 1 217#define BROADCAST_ONE 1
218#define BROADCAST_REGISTERED 2 218#define BROADCAST_REGISTERED 2
219#define BROADCAST_PROMISC_ONLY 4 219#define BROADCAST_PROMISC_ONLY 4
220static int pfkey_broadcast(struct sk_buff *skb, int allocation, 220static int pfkey_broadcast(struct sk_buff *skb, unsigned int __nocast allocation,
221 int broadcast_flags, struct sock *one_sk) 221 int broadcast_flags, struct sock *one_sk)
222{ 222{
223 struct sock *sk; 223 struct sock *sk;
@@ -1416,7 +1416,8 @@ static int pfkey_get(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr,
1416 return 0; 1416 return 0;
1417} 1417}
1418 1418
1419static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, int allocation) 1419static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig,
1420 unsigned int __nocast allocation)
1420{ 1421{
1421 struct sk_buff *skb; 1422 struct sk_buff *skb;
1422 struct sadb_msg *hdr; 1423 struct sadb_msg *hdr;
@@ -2153,6 +2154,7 @@ out:
2153 2154
2154static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs) 2155static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
2155{ 2156{
2157 unsigned int dir;
2156 int err; 2158 int err;
2157 struct sadb_x_policy *pol; 2159 struct sadb_x_policy *pol;
2158 struct xfrm_policy *xp; 2160 struct xfrm_policy *xp;
@@ -2161,7 +2163,11 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2161 if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL) 2163 if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL)
2162 return -EINVAL; 2164 return -EINVAL;
2163 2165
2164 xp = xfrm_policy_byid(0, pol->sadb_x_policy_id, 2166 dir = xfrm_policy_id2dir(pol->sadb_x_policy_id);
2167 if (dir >= XFRM_POLICY_MAX)
2168 return -EINVAL;
2169
2170 xp = xfrm_policy_byid(dir, pol->sadb_x_policy_id,
2165 hdr->sadb_msg_type == SADB_X_SPDDELETE2); 2171 hdr->sadb_msg_type == SADB_X_SPDDELETE2);
2166 if (xp == NULL) 2172 if (xp == NULL)
2167 return -ENOENT; 2173 return -ENOENT;
@@ -2173,9 +2179,9 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2173 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) { 2179 if (hdr->sadb_msg_type == SADB_X_SPDDELETE2) {
2174 c.data.byid = 1; 2180 c.data.byid = 1;
2175 c.event = XFRM_MSG_DELPOLICY; 2181 c.event = XFRM_MSG_DELPOLICY;
2176 km_policy_notify(xp, pol->sadb_x_policy_dir-1, &c); 2182 km_policy_notify(xp, dir, &c);
2177 } else { 2183 } else {
2178 err = key_pol_get_resp(sk, xp, hdr, pol->sadb_x_policy_dir-1); 2184 err = key_pol_get_resp(sk, xp, hdr, dir);
2179 } 2185 }
2180 2186
2181 xfrm_pol_put(xp); 2187 xfrm_pol_put(xp);