diff mbox series

l2tp: Remove redundant BUG_ON() check in l2tp_pernet

Message ID 1578043696-35911-1-git-send-email-vulab@iscas.ac.cn
State Accepted
Delegated to: David Miller
Headers show
Series l2tp: Remove redundant BUG_ON() check in l2tp_pernet | expand

Commit Message

Xu Wang Jan. 3, 2020, 9:28 a.m. UTC
Passing NULL to l2tp_pernet causes a crash via BUG_ON.
Dereferencing net in net_generic() also has the same effect.
This patch removes the redundant BUG_ON check on the same parameter.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 net/l2tp/l2tp_core.c | 2 --
 1 file changed, 2 deletions(-)

Comments

David Miller Jan. 3, 2020, 8:26 p.m. UTC | #1
From: Xu Wang <vulab@iscas.ac.cn>
Date: Fri,  3 Jan 2020 09:28:16 +0000

> Passing NULL to l2tp_pernet causes a crash via BUG_ON.
> Dereferencing net in net_generic() also has the same effect.
> This patch removes the redundant BUG_ON check on the same parameter.
> 
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>

Applied.
diff mbox series

Patch

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index f82ea12..c99223c 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -122,8 +122,6 @@  static inline struct l2tp_tunnel *l2tp_tunnel(struct sock *sk)
 
 static inline struct l2tp_net *l2tp_pernet(const struct net *net)
 {
-	BUG_ON(!net);
-
 	return net_generic(net, l2tp_net_id);
 }