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] [day] [month] [year] [list]
Message-Id: <20080120.165716.172421176.davem@davemloft.net>
Date:	Sun, 20 Jan 2008 16:57:16 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	akpm@...ux-foundation.org
Cc:	fubar@...ibm.com, olel@....pl, jeff@...zik.org,
	shemminger@...ux-foundation.org, netdev@...r.kernel.org
Subject: Re: [patch for 2.6.24? 1/1] bonding: locking fix

From: Andrew Morton <akpm@...ux-foundation.org>
Date: Thu, 17 Jan 2008 15:42:43 -0800

> Applying this:
> 
> --- a/drivers/net/bonding/bond_sysfs.c~bonding-locking-fix
> +++ a/drivers/net/bonding/bond_sysfs.c
> @@ -1111,8 +1111,6 @@ static ssize_t bonding_store_primary(str
>  out:
>  	write_unlock_bh(&bond->lock);
>  
> -	rtnl_unlock();
> -
>  	return count;
>  }
>  static DEVICE_ATTR(primary, S_IRUGO | S_IWUSR, bonding_show_primary, bonding_store_primary);
> 
> 
> is better than doing nothing.

If you look at the change that introduced this:

    commit 6603a6f25e4bca922a7dfbf0bf03072d98850176
    Author: Jay Vosburgh <fubar@...ibm.com>
    Date:   Wed Oct 17 17:37:50 2007 -0700

    bonding: Convert more locks to _bh, acquire rtnl, for new locking
    
    	Convert more lock acquisitions to _bh flavor to avoid deadlock
    with workqueue activity and add acquisition of RTNL in appropriate places.
    Affects ALB mode, as well as core bonding functions and sysfs.
    
    Signed-off-by: Andy Gospodarek <andy@...yhouse.net>
    Signed-off-by: Jay Vosburgh <fubar@...ibm.com>
    Signed-off-by: Jeff Garzik <jeff@...zik.org>

It is clearly the author's intent to surround the execution
of this function (and also bonding_show_active_slave() which
was done correctly) with RTNL semaphore holding.

Therefore the correct fix, which I'll push, is:

commit 991a15cb1cd60a918bd864bb79e7649c30aab275
Author: David S. Miller <davem@...emloft.net>
Date:   Sun Jan 20 16:55:20 2008 -0800

    [BONDING]: Fix rtnl locking in bonding_store_primary().
    
    Changeset 6603a6f25e4bca922a7dfbf0bf03072d98850176 (Convert more locks
    to _bh, acquire rtnl, for new locking) added a regression.
    
    A rtnl_unlock() was added but a rtnl_lock() was not.
    
    Signed-off-by: David S. Miller <davem@...emloft.net>

diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 11b76b3..4845c01 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1075,6 +1075,7 @@ static ssize_t bonding_store_primary(struct device *d,
 	struct slave *slave;
 	struct bonding *bond = to_bond(d);
 
+	rtnl_lock();
 	write_lock_bh(&bond->lock);
 	if (!USES_PRIMARY(bond->params.mode)) {
 		printk(KERN_INFO DRV_NAME
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ