bcd4fbfbc12f50dd799c9b24ee9d9b125667d1be
[openwrt/staging/wigyori.git] /
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3 Date: Wed, 18 Mar 2020 18:30:46 -0600
4 Subject: [PATCH] wireguard: receive: remove dead code from default packet type
5 case
6
7 commit 2b8765c52db24c0fbcc81bac9b5e8390f2c7d3c8 upstream.
8
9 The situation in which we wind up hitting the default case here
10 indicates a major bug in earlier parsing code. It is not a usual thing
11 that should ever happen, which means a "friendly" message for it doesn't
12 make sense. Rather, replace this with a WARN_ON, just like we do earlier
13 in the file for a similar situation, so that somebody sends us a bug
14 report and we can fix it.
15
16 Reported-by: Fabian Freyer <fabianfreyer@radicallyopensecurity.com>
17 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
20 ---
21 drivers/net/wireguard/receive.c | 3 +--
22 1 file changed, 1 insertion(+), 2 deletions(-)
23
24 --- a/drivers/net/wireguard/receive.c
25 +++ b/drivers/net/wireguard/receive.c
26 @@ -587,8 +587,7 @@ void wg_packet_receive(struct wg_device
27 wg_packet_consume_data(wg, skb);
28 break;
29 default:
30 - net_dbg_skb_ratelimited("%s: Invalid packet from %pISpfsc\n",
31 - wg->dev->name, skb);
32 + WARN(1, "Non-exhaustive parsing of packet header lead to unknown packet type!\n");
33 goto err;
34 }
35 return;