blob: bcd4fbfbc12f50dd799c9b24ee9d9b125667d1be [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: "Jason A. Donenfeld" <Jason@zx2c4.com>
3Date: Wed, 18 Mar 2020 18:30:46 -0600
4Subject: [PATCH] wireguard: receive: remove dead code from default packet type
5 case
6
7commit 2b8765c52db24c0fbcc81bac9b5e8390f2c7d3c8 upstream.
8
9The situation in which we wind up hitting the default case here
10indicates a major bug in earlier parsing code. It is not a usual thing
11that should ever happen, which means a "friendly" message for it doesn't
12make sense. Rather, replace this with a WARN_ON, just like we do earlier
13in the file for a similar situation, so that somebody sends us a bug
14report and we can fix it.
15
16Reported-by: Fabian Freyer <fabianfreyer@radicallyopensecurity.com>
17Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
18Signed-off-by: David S. Miller <davem@davemloft.net>
19Signed-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;