aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_algo.c13
-rw-r--r--net/xfrm/xfrm_hash.h4
-rw-r--r--net/xfrm/xfrm_ipcomp.c18
-rw-r--r--net/xfrm/xfrm_policy.c7
-rw-r--r--net/xfrm/xfrm_state.c6
5 files changed, 22 insertions, 26 deletions
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index ab4ef72f0b1d..debe733386f8 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -802,17 +802,4 @@ int xfrm_count_pfkey_enc_supported(void)
802} 802}
803EXPORT_SYMBOL_GPL(xfrm_count_pfkey_enc_supported); 803EXPORT_SYMBOL_GPL(xfrm_count_pfkey_enc_supported);
804 804
805#if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
806
807void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)
808{
809 if (tail != skb) {
810 skb->data_len += len;
811 skb->len += len;
812 }
813 return skb_put(tail, len);
814}
815EXPORT_SYMBOL_GPL(pskb_put);
816#endif
817
818MODULE_LICENSE("GPL"); 805MODULE_LICENSE("GPL");
diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h
index 716502ada53b..0622d319e1f2 100644
--- a/net/xfrm/xfrm_hash.h
+++ b/net/xfrm/xfrm_hash.h
@@ -130,7 +130,7 @@ static inline unsigned int __addr_hash(const xfrm_address_t *daddr,
130 return h & hmask; 130 return h & hmask;
131} 131}
132 132
133extern struct hlist_head *xfrm_hash_alloc(unsigned int sz); 133struct hlist_head *xfrm_hash_alloc(unsigned int sz);
134extern void xfrm_hash_free(struct hlist_head *n, unsigned int sz); 134void xfrm_hash_free(struct hlist_head *n, unsigned int sz);
135 135
136#endif /* _XFRM_HASH_H */ 136#endif /* _XFRM_HASH_H */
diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index 2906d520eea7..ccfdc7115a83 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -141,14 +141,14 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
141 const int plen = skb->len; 141 const int plen = skb->len;
142 int dlen = IPCOMP_SCRATCH_SIZE; 142 int dlen = IPCOMP_SCRATCH_SIZE;
143 u8 *start = skb->data; 143 u8 *start = skb->data;
144 const int cpu = get_cpu(); 144 struct crypto_comp *tfm;
145 u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu); 145 u8 *scratch;
146 struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu);
147 int err; 146 int err;
148 147
149 local_bh_disable(); 148 local_bh_disable();
149 scratch = *this_cpu_ptr(ipcomp_scratches);
150 tfm = *this_cpu_ptr(ipcd->tfms);
150 err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); 151 err = crypto_comp_compress(tfm, start, plen, scratch, &dlen);
151 local_bh_enable();
152 if (err) 152 if (err)
153 goto out; 153 goto out;
154 154
@@ -158,13 +158,13 @@ static int ipcomp_compress(struct xfrm_state *x, struct sk_buff *skb)
158 } 158 }
159 159
160 memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen); 160 memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
161 put_cpu(); 161 local_bh_enable();
162 162
163 pskb_trim(skb, dlen + sizeof(struct ip_comp_hdr)); 163 pskb_trim(skb, dlen + sizeof(struct ip_comp_hdr));
164 return 0; 164 return 0;
165 165
166out: 166out:
167 put_cpu(); 167 local_bh_enable();
168 return err; 168 return err;
169} 169}
170 170
@@ -220,8 +220,8 @@ static void ipcomp_free_scratches(void)
220 220
221static void * __percpu *ipcomp_alloc_scratches(void) 221static void * __percpu *ipcomp_alloc_scratches(void)
222{ 222{
223 int i;
224 void * __percpu *scratches; 223 void * __percpu *scratches;
224 int i;
225 225
226 if (ipcomp_scratch_users++) 226 if (ipcomp_scratch_users++)
227 return ipcomp_scratches; 227 return ipcomp_scratches;
@@ -233,7 +233,9 @@ static void * __percpu *ipcomp_alloc_scratches(void)
233 ipcomp_scratches = scratches; 233 ipcomp_scratches = scratches;
234 234
235 for_each_possible_cpu(i) { 235 for_each_possible_cpu(i) {
236 void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE); 236 void *scratch;
237
238 scratch = vmalloc_node(IPCOMP_SCRATCH_SIZE, cpu_to_node(i));
237 if (!scratch) 239 if (!scratch)
238 return NULL; 240 return NULL;
239 *per_cpu_ptr(scratches, i) = scratch; 241 *per_cpu_ptr(scratches, i) = scratch;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 767c74a91db3..0d49945d0b9e 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1844,6 +1844,13 @@ static int xdst_queue_output(struct sk_buff *skb)
1844 struct xfrm_dst *xdst = (struct xfrm_dst *) dst; 1844 struct xfrm_dst *xdst = (struct xfrm_dst *) dst;
1845 struct xfrm_policy *pol = xdst->pols[0]; 1845 struct xfrm_policy *pol = xdst->pols[0];
1846 struct xfrm_policy_queue *pq = &pol->polq; 1846 struct xfrm_policy_queue *pq = &pol->polq;
1847 const struct sk_buff *fclone = skb + 1;
1848
1849 if (unlikely(skb->fclone == SKB_FCLONE_ORIG &&
1850 fclone->fclone == SKB_FCLONE_CLONE)) {
1851 kfree_skb(skb);
1852 return 0;
1853 }
1847 1854
1848 if (pq->hold_queue.qlen > XFRM_MAX_QUEUE_LEN) { 1855 if (pq->hold_queue.qlen > XFRM_MAX_QUEUE_LEN) {
1849 kfree_skb(skb); 1856 kfree_skb(skb);
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index dbf0719df5b0..8ed9d0dd4566 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -468,7 +468,7 @@ expired:
468 } 468 }
469 469
470 err = __xfrm_state_delete(x); 470 err = __xfrm_state_delete(x);
471 if (!err && x->id.spi) 471 if (!err)
472 km_state_expired(x, 1, 0); 472 km_state_expired(x, 1, 0);
473 473
474 xfrm_audit_state_delete(x, err ? 0 : 1, 474 xfrm_audit_state_delete(x, err ? 0 : 1,
@@ -815,7 +815,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
815 xfrm_state_look_at(pol, x, fl, encap_family, 815 xfrm_state_look_at(pol, x, fl, encap_family,
816 &best, &acquire_in_progress, &error); 816 &best, &acquire_in_progress, &error);
817 } 817 }
818 if (best) 818 if (best || acquire_in_progress)
819 goto found; 819 goto found;
820 820
821 h_wildcard = xfrm_dst_hash(net, daddr, &saddr_wildcard, tmpl->reqid, encap_family); 821 h_wildcard = xfrm_dst_hash(net, daddr, &saddr_wildcard, tmpl->reqid, encap_family);
@@ -824,7 +824,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
824 x->props.reqid == tmpl->reqid && 824 x->props.reqid == tmpl->reqid &&
825 (mark & x->mark.m) == x->mark.v && 825 (mark & x->mark.m) == x->mark.v &&
826 !(x->props.flags & XFRM_STATE_WILDRECV) && 826 !(x->props.flags & XFRM_STATE_WILDRECV) &&
827 xfrm_state_addr_check(x, daddr, saddr, encap_family) && 827 xfrm_addr_equal(&x->id.daddr, daddr, encap_family) &&
828 tmpl->mode == x->props.mode && 828 tmpl->mode == x->props.mode &&
829 tmpl->id.proto == x->id.proto && 829 tmpl->id.proto == x->id.proto &&
830 (tmpl->id.spi == x->id.spi || !tmpl->id.spi)) 830 (tmpl->id.spi == x->id.spi || !tmpl->id.spi))