提交 671b53ee 编写于 作者: S Shradha Shah 提交者: David S. Miller

sfc: Ensure down_write(&filter_sem) and up_write() are matched before calling efx_net_open()

This patch avoids the double up_write to filter_sem if
efx_net_open() fails.

Resolves: 2d432f20Signed-off-by: NShradha Shah <sshah@solarflare.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f1158b74
...@@ -598,21 +598,21 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan, ...@@ -598,21 +598,21 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan,
MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL, MC_CMD_VPORT_ALLOC_IN_VPORT_TYPE_NORMAL,
vf->vlan, &vf->vport_id); vf->vlan, &vf->vport_id);
if (rc) if (rc)
goto reset_nic; goto reset_nic_up_write;
restore_mac: restore_mac:
if (!is_zero_ether_addr(vf->mac)) { if (!is_zero_ether_addr(vf->mac)) {
rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac); rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac);
if (rc2) { if (rc2) {
eth_zero_addr(vf->mac); eth_zero_addr(vf->mac);
goto reset_nic; goto reset_nic_up_write;
} }
} }
restore_evb_port: restore_evb_port:
rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i); rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i);
if (rc2) if (rc2)
goto reset_nic; goto reset_nic_up_write;
else else
vf->vport_assigned = 1; vf->vport_assigned = 1;
...@@ -620,14 +620,16 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan, ...@@ -620,14 +620,16 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan,
if (vf->efx) { if (vf->efx) {
rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED); rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED);
if (rc2) if (rc2)
goto reset_nic; goto reset_nic_up_write;
} }
restore_filters: restore_filters:
if (vf->efx) { if (vf->efx) {
rc2 = vf->efx->type->filter_table_probe(vf->efx); rc2 = vf->efx->type->filter_table_probe(vf->efx);
if (rc2) if (rc2)
goto reset_nic; goto reset_nic_up_write;
up_write(&vf->efx->filter_sem);
up_write(&vf->efx->filter_sem); up_write(&vf->efx->filter_sem);
...@@ -639,9 +641,12 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan, ...@@ -639,9 +641,12 @@ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i, u16 vlan,
} }
return rc; return rc;
reset_nic_up_write:
if (vf->efx)
up_write(&vf->efx->filter_sem);
reset_nic: reset_nic:
if (vf->efx) { if (vf->efx) {
up_write(&vf->efx->filter_sem);
netif_err(efx, drv, efx->net_dev, netif_err(efx, drv, efx->net_dev,
"Failed to restore VF - scheduling reset.\n"); "Failed to restore VF - scheduling reset.\n");
efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH); efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册