diff options
Diffstat (limited to 'net/key/af_key.c')
-rw-r--r-- | net/key/af_key.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c index 4879743b945a..39031684b65c 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 | ||
187 | static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, | 187 | static int pfkey_broadcast_one(struct sk_buff *skb, struct sk_buff **skb2, |
188 | int allocation, struct sock *sk) | 188 | gfp_t 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 |
220 | static int pfkey_broadcast(struct sk_buff *skb, int allocation, | 220 | static int pfkey_broadcast(struct sk_buff *skb, gfp_t 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 | ||
1419 | static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, int allocation) | 1419 | static struct sk_buff *compose_sadb_supported(struct sadb_msg *orig, |
1420 | gfp_t 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 | ||
2154 | static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs) | 2155 | static 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); |