Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-22 Thread Bjørn Mork
Jay Vosburgh writes: > Michael J Dilmore wrote: > >>if (WARN_ON(!new_active_slave) { >>netdev_dbg("Can't add new active slave - pointer null"); >>return ERROR_CODE >>} > > In general, yes, but in this case, the condition should be > impossible to hit, so BUG_ON seems appropriate. I

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-22 Thread Michal Kubecek
On Thu, Jun 22, 2017 at 12:04:54AM +0100, Michael J Dilmore wrote: > > Is it worth at least wrapping BUG_ON in an unlikely macro then? See BUG_ON() definition: #ifndef HAVE_ARCH_BUG_ON #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) #endif where HAVE_ARCH_BUG_ON is de

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Michael J Dilmore
On 21/06/17 23:39, Jay Vosburgh wrote: Michael J Dilmore wrote: On 21/06/17 22:56, David Miller wrote: From: Michael D Date: Wed, 21 Jun 2017 22:41:07 +0100 I don't think you can stop it being dereferenced... you just need to prevent an attacker from exploiting the null pointer dereferenc

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Jay Vosburgh
Michael J Dilmore wrote: >On 21/06/17 22:56, David Miller wrote: > >> From: Michael D >> Date: Wed, 21 Jun 2017 22:41:07 +0100 >> >>> I don't think you can stop it being dereferenced... you just need to >>> prevent an attacker from exploiting the null pointer dereference >>> vulnerability right?

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Jay Vosburgh
David Miller wrote: >From: Michael D >Date: Wed, 21 Jun 2017 22:41:07 +0100 > >> I don't think you can stop it being dereferenced... you just need to >> prevent an attacker from exploiting the null pointer dereference >> vulnerability right? And this is done by returning the function right >> aw

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Michael J Dilmore
On 21/06/17 22:56, David Miller wrote: From: Michael D Date: Wed, 21 Jun 2017 22:41:07 +0100 I don't think you can stop it being dereferenced... you just need to prevent an attacker from exploiting the null pointer dereference vulnerability right? And this is done by returning the function ri

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread David Miller
From: Michael D Date: Wed, 21 Jun 2017 22:41:07 +0100 > I don't think you can stop it being dereferenced... you just need to > prevent an attacker from exploiting the null pointer dereference > vulnerability right? And this is done by returning the function right > away? What's all of this about

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread David Miller
And please stop top posting, thank you.

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Michael D
I don't think you can stop it being dereferenced... you just need to prevent an attacker from exploiting the null pointer dereference vulnerability right? And this is done by returning the function right away? On 21 June 2017 at 22:36, David Miller wrote: > From: Michael D > Date: Wed, 21 Ju

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread David Miller
From: Michael D Date: Wed, 21 Jun 2017 22:35:56 +0100 > How do we actually stop a null pointer being dereferenced here? Maybe that's why it's a BUG_ON(), there is no reasonable way to continue if the pointer is NULL.

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Michael D
How do we actually stop a null pointer being dereferenced here? Other examples I've seen check for null and then immediately return the function with an error code so that it cannot be referenced again. Something like: if (WARN_ON(!new_active) return 1 This behaviour should be OK for this f

Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Jay Vosburgh
Michael J Dilmore wrote: >The function below contains a BUG_ON where no active slave is detected. The >patch >converts this to a WARN_ON to avoid crashing the kernel. > >Signed-off-by: Michael J Dilmore >--- > drivers/net/bonding/bond_options.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletio

[PATCH] Convert BUG_ON to WARN_ON in bond_options.c

2017-06-21 Thread Michael J Dilmore
The function below contains a BUG_ON where no active slave is detected. The patch converts this to a WARN_ON to avoid crashing the kernel. Signed-off-by: Michael J Dilmore --- drivers/net/bonding/bond_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bond