Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wireguard: receive: remove dead code from default packet type case

The situation in which we wind up hitting the default case here
indicates a major bug in earlier parsing code. It is not a usual thing
that should ever happen, which means a "friendly" message for it doesn't
make sense. Rather, replace this with a WARN_ON, just like we do earlier
in the file for a similar situation, so that somebody sends us a bug
report and we can fix it.

Reported-by: Fabian Freyer <fabianfreyer@radicallyopensecurity.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jason A. Donenfeld and committed by
David S. Miller
2b8765c5 a5588604

+1 -2
+1 -2
drivers/net/wireguard/receive.c
··· 587 587 wg_packet_consume_data(wg, skb); 588 588 break; 589 589 default: 590 - net_dbg_skb_ratelimited("%s: Invalid packet from %pISpfsc\n", 591 - wg->dev->name, skb); 590 + WARN(1, "Non-exhaustive parsing of packet header lead to unknown packet type!\n"); 592 591 goto err; 593 592 } 594 593 return;