lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOMdWS+7s51c3KegKYJGk1KO2maxeS0LBMAQOQDO_-o+fJ6uJQ@mail.gmail.com>
Date:   Wed, 20 Sep 2017 12:41:03 +0530
From:   Allen <allen.lkml@...il.com>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH 05/10] drivers:net: return -ENOMEM on allocation failure.

>
> rlb_initialize() is only called by bond_alb_initialize(), and it
> propagates the -1. That is only called by bond_open() with:
>
>         if (bond_alb_initialize(bond, (BOND_MODE(bond) == BOND_MODE_ALB)))
>                 return -ENOMEM;
>

Would this work?

diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index c02cc81..89df377 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -864,7 +864,7 @@ static int rlb_initialize(struct bonding *bond)

        new_hashtbl = kmalloc(size, GFP_KERNEL);
        if (!new_hashtbl)
-               return -1;
+               return -ENOMEM;

        spin_lock_bh(&bond->mode_lock);

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c99dc59..edef242 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3284,6 +3284,7 @@ static int bond_open(struct net_device *bond_dev)
        struct bonding *bond = netdev_priv(bond_dev);
        struct list_head *iter;
        struct slave *slave;
+       int ret;

        /* reset slave->backup and slave->inactive */
        if (bond_has_slaves(bond)) {
@@ -3303,8 +3304,9 @@ static int bond_open(struct net_device *bond_dev)
                /* bond_alb_initialize must be called before the timer
                 * is started.
                 */
-               if (bond_alb_initialize(bond, (BOND_MODE(bond) ==
BOND_MODE_ALB)))
-                       return -ENOMEM;
+               ret = bond_alb_initialize(bond, (BOND_MODE(bond) ==
BOND_MODE_ALB));
+               if (ret)
+                       return ret;
                if (bond->params.tlb_dynamic_lb)
                        queue_delayed_work(bond->wq, &bond->alb_work, 0);
        }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ