up_write(&(bonding_rwsem)); 
static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd){	struct net_device *slave_dev = NULL;	struct ifbond k_binfo;	struct ifbond __user *u_binfo = NULL;	struct ifslave k_sinfo;	struct ifslave __user *u_sinfo = NULL;	struct mii_ioctl_data *mii = NULL;	int res = 0;	dprintk("bond_ioctl: master=%s, cmd=%d\n",		bond_dev->name, cmd);	switch (cmd) {	case SIOCGMIIPHY:		mii = if_mii(ifr);		if (!mii) {			return -EINVAL;		}		mii->phy_id = 0;		/* Fall Through */	case SIOCGMIIREG:		/*		 * We do this again just in case we were called by SIOCGMIIREG		 * instead of SIOCGMIIPHY.		 */		mii = if_mii(ifr);		if (!mii) {			return -EINVAL;		}		if (mii->reg_num == 1) {			struct bonding *bond = bond_dev->priv;			mii->val_out = 0;			read_lock_bh(&bond->lock);			read_lock(&bond->curr_slave_lock);			if (bond->curr_active_slave) {				mii->val_out = BMSR_LSTATUS;			}			read_unlock(&bond->curr_slave_lock);			read_unlock_bh(&bond->lock);		}		return 0;	case BOND_INFO_QUERY_OLD:	case SIOCBONDINFOQUERY:		u_binfo = (struct ifbond __user *)ifr->ifr_data;		if (copy_from_user(&k_binfo, u_binfo, sizeof(ifbond))) {			return -EFAULT;		}		res = bond_info_query(bond_dev, &k_binfo);		if (res == 0) {			if (copy_to_user(u_binfo, &k_binfo, sizeof(ifbond))) {				return -EFAULT;			}		}		return res;	case BOND_SLAVE_INFO_QUERY_OLD:	case SIOCBONDSLAVEINFOQUERY:		u_sinfo = (struct ifslave __user *)ifr->ifr_data;		if (copy_from_user(&k_sinfo, u_sinfo, sizeof(ifslave))) {			return -EFAULT;		}		res = bond_slave_info_query(bond_dev, &k_sinfo);		if (res == 0) {			if (copy_to_user(u_sinfo, &k_sinfo, sizeof(ifslave))) {				return -EFAULT;			}		}		return res;	default:		/* Go on */		break;	}	if (!capable(CAP_NET_ADMIN)) {		return -EPERM;	}	slave_dev = dev_get_by_name(ifr->ifr_slave);	dprintk("slave_dev=%p: \n", slave_dev);	if (!slave_dev) {		res = -ENODEV;	} else {		dprintk("slave_dev->name=%s: \n", slave_dev->name);		switch (cmd) {		case BOND_ENSLAVE_OLD:		case SIOCBONDENSLAVE:			res = bond_enslave(bond_dev, slave_dev);			break;		case BOND_RELEASE_OLD:		case SIOCBONDRELEASE:			res = bond_release(bond_dev, slave_dev);			break;		case BOND_SETHWADDR_OLD:		case SIOCBONDSETHWADDR:			res = bond_sethwaddr(bond_dev, slave_dev);			break;		case BOND_CHANGE_ACTIVE_OLD:		case SIOCBONDCHANGEACTIVE:			res = bond_ioctl_change_active(bond_dev, slave_dev);			break;		default:			res = -EOPNOTSUPP;		}		dev_put(slave_dev);	}	return res;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b76cdba9cdb29b091cacb4c11534ffb2eac02f64/bond_main.c/buggy/drivers/net/bonding/bond_main.c