Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1671931

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

From Jay Vosburgh <jay.vosburgh@canonical.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c
Date 2017-06-21 20:40 +0200
Message-ID <tUSHL-1ub-1@gated-at.bofh.it> (permalink)
References <tUSeK-1fP-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Michael J Dilmore <michael.j.dilmore@gmail.com> 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 <michael.j.dilmore@gmail.com>
>---
> drivers/net/bonding/bond_options.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
>index 1bcbb89..c4b4791 100644
>--- a/drivers/net/bonding/bond_options.c
>+++ b/drivers/net/bonding/bond_options.c
>@@ -778,7 +778,7 @@ static int bond_option_active_slave_set(struct bonding *bond,
> 		struct slave *old_active = rtnl_dereference(bond->curr_active_slave);
> 		struct slave *new_active = bond_slave_get_rtnl(slave_dev);
> 
>-		BUG_ON(!new_active);
>+		WARN_ON(!new_active);

	This is a reasonable idea in principle, but will require
additional changes to prevent dereferencing new_active if it is NULL
(which would happen just below this point in the code).

	-J

> 		if (new_active == old_active) {
> 			/* do nothing */
>-- 
>2.7.4
>

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Convert BUG_ON to WARN_ON in bond_options.c Michael J Dilmore <michael.j.dilmore@gmail.com> - 2017-06-21 20:10 +0200
  Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Jay Vosburgh <jay.vosburgh@canonical.com> - 2017-06-21 20:40 +0200
    Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c David Miller <davem@davemloft.net> - 2017-06-21 23:40 +0200
      Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Michael D <michael.j.dilmore@gmail.com> - 2017-06-21 23:50 +0200
        Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c David Miller <davem@davemloft.net> - 2017-06-22 00:00 +0200
          Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Michael J Dilmore <michael.j.dilmore@gmail.com> - 2017-06-22 00:30 +0200
            Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Jay Vosburgh <jay.vosburgh@canonical.com> - 2017-06-22 00:40 +0200
              Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Michael J Dilmore <michael.j.dilmore@gmail.com> - 2017-06-22 01:10 +0200
                Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Michal Kubecek <mkubecek@suse.cz> - 2017-06-22 10:10 +0200
              Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Bjørn Mork <bjorn@mork.no> - 2017-06-22 10:20 +0200
          Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Jay Vosburgh <jay.vosburgh@canonical.com> - 2017-06-22 00:40 +0200
        Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c David Miller <davem@davemloft.net> - 2017-06-22 00:00 +0200
    Re: [PATCH] Convert BUG_ON to WARN_ON in bond_options.c Michael D <michael.j.dilmore@gmail.com> - 2017-06-21 23:40 +0200

csiph-web