* [PATCH net] ionic: fix vf op lock usage
@ 2020-03-04 17:21 Shannon Nelson
2020-03-04 17:31 ` Parav Pandit
0 siblings, 1 reply; 3+ messages in thread
From: Shannon Nelson @ 2020-03-04 17:21 UTC (permalink / raw)
To: davem, netdev; +Cc: Shannon Nelson
These are a couple of read locks that should be write locks.
Fixes: commit fbb39807e9ae ("ionic: support sr-iov operations")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
---
drivers/net/ethernet/pensando/ionic/ionic_lif.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
index 191271f6260d..c2f5b691e0fa 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
@@ -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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH net] ionic: fix vf op lock usage
2020-03-04 17:21 [PATCH net] ionic: fix vf op lock usage Shannon Nelson
@ 2020-03-04 17:31 ` Parav Pandit
2020-03-04 17:38 ` Shannon Nelson
0 siblings, 1 reply; 3+ messages in thread
From: Parav Pandit @ 2020-03-04 17:31 UTC (permalink / raw)
To: Shannon Nelson, davem, netdev
> Sent: Wednesday, March 4, 2020 11:22 AM
> To: davem@davemloft.net; netdev@vger.kernel.org
> These are a couple of read locks that should be write locks.
>
> Fixes: commit fbb39807e9ae ("ionic: support sr-iov operations")
It should be,
Fixes: fbb39807e9ae ("ionic: support sr-iov operations")
> Signed-off-by: Shannon Nelson <snelson@pensando.io>
> ---
> drivers/net/ethernet/pensando/ionic/ionic_lif.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> index 191271f6260d..c2f5b691e0fa 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
> @@ -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;
> }
>
> --
> 2.17.1
I missed to review this after Christmas break.
Reviewed-by: Parav Pandit <parav@mellanox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] ionic: fix vf op lock usage
2020-03-04 17:31 ` Parav Pandit
@ 2020-03-04 17:38 ` Shannon Nelson
0 siblings, 0 replies; 3+ messages in thread
From: Shannon Nelson @ 2020-03-04 17:38 UTC (permalink / raw)
To: Parav Pandit, davem, netdev
On 3/4/20 9:31 AM, Parav Pandit wrote:
>> Sent: Wednesday, March 4, 2020 11:22 AM
>> To: davem@davemloft.net; netdev@vger.kernel.org
>> These are a couple of read locks that should be write locks.
>>
>> Fixes: commit fbb39807e9ae ("ionic: support sr-iov operations")
> It should be,
>
> Fixes: fbb39807e9ae ("ionic: support sr-iov operations")
Thanks, I'll fix that.
sln
>
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> ---
>> drivers/net/ethernet/pensando/ionic/ionic_lif.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> index 191271f6260d..c2f5b691e0fa 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c
>> @@ -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;
>> }
>>
>> --
>> 2.17.1
> I missed to review this after Christmas break.
>
> Reviewed-by: Parav Pandit <parav@mellanox.com>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-04 17:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04 17:21 [PATCH net] ionic: fix vf op lock usage Shannon Nelson
2020-03-04 17:31 ` Parav Pandit
2020-03-04 17:38 ` Shannon Nelson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).