Commit e396ce5f authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller
Browse files

ionic: fix vf op lock usage



These are a couple of read locks that should be write locks.

Fixes: fbb39807 ("ionic: support sr-iov operations")
Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7469e83
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1688,7 +1688,7 @@ static int ionic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
	if (!(is_zero_ether_addr(mac) || is_valid_ether_addr(mac)))
		return -EINVAL;

	down_read(&ionic->vf_op_lock);
	down_write(&ionic->vf_op_lock);

	if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) {
		ret = -EINVAL;
@@ -1698,7 +1698,7 @@ static int ionic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
			ether_addr_copy(ionic->vfs[vf].macaddr, mac);
	}

	up_read(&ionic->vf_op_lock);
	up_write(&ionic->vf_op_lock);
	return ret;
}

@@ -1719,7 +1719,7 @@ static int ionic_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
	if (proto != htons(ETH_P_8021Q))
		return -EPROTONOSUPPORT;

	down_read(&ionic->vf_op_lock);
	down_write(&ionic->vf_op_lock);

	if (vf >= pci_num_vf(ionic->pdev) || !ionic->vfs) {
		ret = -EINVAL;
@@ -1730,7 +1730,7 @@ static int ionic_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,
			ionic->vfs[vf].vlanid = vlan;
	}

	up_read(&ionic->vf_op_lock);
	up_write(&ionic->vf_op_lock);
	return ret;
}