Commit 30724ccb authored by David S. Miller's avatar David S. Miller

Merge branch 'wireguard-fixes'

Jason A. Donenfeld says:

====================
wireguard fixes for 5.7-rc4

This series contains two fixes and a cleanup for wireguard:

1) Removal of a spurious newline, from Sultan Alsawaf.

2) Fix for a memory leak in an error path, in which memory allocated
   prior to the error wasn't freed, reported by Sultan Alsawaf.

3) Fix to ECN support to use RFC6040 properly like all the other tunnel
   drivers, from Toke Høiland-Jørgensen.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 42c556fe eebabcb2
...@@ -35,8 +35,10 @@ int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function, ...@@ -35,8 +35,10 @@ int wg_packet_queue_init(struct crypt_queue *queue, work_func_t function,
if (multicore) { if (multicore) {
queue->worker = wg_packet_percpu_multicore_worker_alloc( queue->worker = wg_packet_percpu_multicore_worker_alloc(
function, queue); function, queue);
if (!queue->worker) if (!queue->worker) {
ptr_ring_cleanup(&queue->ring, NULL);
return -ENOMEM; return -ENOMEM;
}
} else { } else {
INIT_WORK(&queue->work, function); INIT_WORK(&queue->work, function);
} }
......
...@@ -393,13 +393,11 @@ static void wg_packet_consume_data_done(struct wg_peer *peer, ...@@ -393,13 +393,11 @@ static void wg_packet_consume_data_done(struct wg_peer *peer,
len = ntohs(ip_hdr(skb)->tot_len); len = ntohs(ip_hdr(skb)->tot_len);
if (unlikely(len < sizeof(struct iphdr))) if (unlikely(len < sizeof(struct iphdr)))
goto dishonest_packet_size; goto dishonest_packet_size;
if (INET_ECN_is_ce(PACKET_CB(skb)->ds)) INET_ECN_decapsulate(skb, PACKET_CB(skb)->ds, ip_hdr(skb)->tos);
IP_ECN_set_ce(ip_hdr(skb));
} else if (skb->protocol == htons(ETH_P_IPV6)) { } else if (skb->protocol == htons(ETH_P_IPV6)) {
len = ntohs(ipv6_hdr(skb)->payload_len) + len = ntohs(ipv6_hdr(skb)->payload_len) +
sizeof(struct ipv6hdr); sizeof(struct ipv6hdr);
if (INET_ECN_is_ce(PACKET_CB(skb)->ds)) INET_ECN_decapsulate(skb, PACKET_CB(skb)->ds, ipv6_get_dsfield(ipv6_hdr(skb)));
IP6_ECN_set_ce(skb, ipv6_hdr(skb));
} else { } else {
goto dishonest_packet_type; goto dishonest_packet_type;
} }
......
...@@ -304,7 +304,6 @@ void wg_packet_encrypt_worker(struct work_struct *work) ...@@ -304,7 +304,6 @@ void wg_packet_encrypt_worker(struct work_struct *work)
} }
wg_queue_enqueue_per_peer(&PACKET_PEER(first)->tx_queue, first, wg_queue_enqueue_per_peer(&PACKET_PEER(first)->tx_queue, first,
state); state);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment