summaryrefslogtreecommitdiffhomepage
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
commit113faae1721bf918cb6993e13752063f73f0b173 (patch)
tree3c1299478c7b6156a77a4db67a7a093f320505ca /src/socket.c
parent323636085e1a6c063818a697b30e074578db258e (diff)
global: add space around variable declarations
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
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));