aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/compat/dst_cache
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-04-07 22:50:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-04-09 05:20:27 +0200
commit09106ec02cdaec979e6178730e7c5e112ea6d368 (patch)
tree09bb6ed2768b39dfa79278d52d61edf8da8403bd /src/compat/dst_cache
parentdata: alloca is actually as dangerous as they say (diff)
downloadwireguard-monolithic-historical-09106ec02cdaec979e6178730e7c5e112ea6d368.tar.xz
wireguard-monolithic-historical-09106ec02cdaec979e6178730e7c5e112ea6d368.zip
compat: support 3.16
Diffstat (limited to 'src/compat/dst_cache')
-rw-r--r--src/compat/dst_cache/dst_cache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compat/dst_cache/dst_cache.c b/src/compat/dst_cache/dst_cache.c
index 145f112..24f1e90 100644
--- a/src/compat/dst_cache/dst_cache.c
+++ b/src/compat/dst_cache/dst_cache.c
@@ -152,8 +152,13 @@ EXPORT_SYMBOL_GPL(dst_cache_get_ip6);
int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
+ BUG_ON(gfp & GFP_ATOMIC);
+ dst_cache->cache = alloc_percpu(struct dst_cache_pcpu);
+#else
dst_cache->cache = alloc_percpu_gfp(struct dst_cache_pcpu,
gfp | __GFP_ZERO);
+#endif
if (!dst_cache->cache)
return -ENOMEM;