2019-12-24 10:33:36

by Xu Wang

[permalink] [raw]
Subject: [PATCH] ppp: Remove redundant BUG_ON() check in ppp_pernet

Passing NULL to ppp_pernet causes a crash via BUG_ON.
Dereferencing net in net_generici() also has the same effect.
This patch removes the redundant BUG_ON check on the same parameter.

Signed-off-by: Xu Wang <[email protected]>
---
drivers/net/ppp/ppp_generic.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 3bf8a8b..22cc2cb 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -296,8 +296,6 @@ static struct class *ppp_class;
/* per net-namespace data */
static inline struct ppp_net *ppp_pernet(struct net *net)
{
- BUG_ON(!net);
-
return net_generic(net, ppp_net_id);
}

--
2.7.4


2019-12-24 11:43:43

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] ppp: Remove redundant BUG_ON() check in ppp_pernet

Hello!

On 12/24/2019 12:37 PM, Xu Wang wrote:

> Passing NULL to ppp_pernet causes a crash via BUG_ON.
> Dereferencing net in net_generici() also has the same effect.

s/generici/generic/. :-)

> This patch removes the redundant BUG_ON check on the same parameter.
>
> Signed-off-by: Xu Wang <[email protected]>
[...]

MBR, Sergei

2019-12-28 00:32:53

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] ppp: Remove redundant BUG_ON() check in ppp_pernet

From: Xu Wang <[email protected]>
Date: Tue, 24 Dec 2019 09:37:04 +0000

> Passing NULL to ppp_pernet causes a crash via BUG_ON.
> Dereferencing net in net_generici() also has the same effect.
> This patch removes the redundant BUG_ON check on the same parameter.
>
> Signed-off-by: Xu Wang <[email protected]>

Applied, thanks.