aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/socket.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-03 14:55:33 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-03 14:55:33 +0200
commit905839bff398d8ce6d050ee766413fa0c7b5d02c (patch)
tree01f377b6cf47772dd53ae87ae39b1c8b2011f03a /src/socket.c
parentglobal: use _WG prefix for include guards (diff)
downloadwireguard-monolithic-historical-905839bff398d8ce6d050ee766413fa0c7b5d02c.tar.xz
wireguard-monolithic-historical-905839bff398d8ce6d050ee766413fa0c7b5d02c.zip
global: add space around variable declarations
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index 4f78de1..da2236c 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -166,8 +166,10 @@ int socket_send_skb_to_peer(struct wireguard_peer *peer, struct sk_buff *skb, u8
int socket_send_buffer_to_peer(struct wireguard_peer *peer, void *buffer, size_t len, u8 ds)
{
struct sk_buff *skb = alloc_skb(len + SKB_HEADER_LEN, GFP_ATOMIC);
+
if (unlikely(!skb))
return -ENOMEM;
+
skb_reserve(skb, SKB_HEADER_LEN);
memcpy(skb_put(skb, len), buffer, len);
return socket_send_skb_to_peer(peer, skb, ds);
@@ -326,6 +328,7 @@ int socket_init(struct wireguard_device *wg)
.ipv6_v6only = true
};
#endif
+
mutex_lock(&wg->socket_update_lock);
#if IS_ENABLED(CONFIG_IPV6)
retry:
@@ -373,6 +376,7 @@ out:
void socket_uninit(struct wireguard_device *wg)
{
struct sock *old4, *old6;
+
mutex_lock(&wg->socket_update_lock);
old4 = rcu_dereference_protected(wg->sock4, lockdep_is_held(&wg->socket_update_lock));
old6 = rcu_dereference_protected(wg->sock6, lockdep_is_held(&wg->socket_update_lock));