netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/1] sfc: Ensure down_write(&filter_sem) and up_write() are matched before calling efx_net_open()
@ 2015-07-08  9:12 Shradha Shah
  2015-07-08 23:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Shradha Shah @ 2015-07-08  9:12 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

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

Resolves: 2d432f20d27c1813a2746008e16dd6ce12a14dc1

Signed-off-by: Shradha Shah <sshah@solarflare.com>
---
 drivers/net/ethernet/sfc/ef10_sriov.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
index 6c9b6e4..1798e7e 100644
--- a/drivers/net/ethernet/sfc/ef10_sriov.c
+++ b/drivers/net/ethernet/sfc/ef10_sriov.c
@@ -640,21 +640,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,
 				  vf->vlan, &vf->vport_id);
 	if (rc)
-		goto reset_nic;
+		goto reset_nic_up_write;
 
 restore_mac:
 	if (!is_zero_ether_addr(vf->mac)) {
 		rc2 = efx_ef10_vport_add_mac(efx, vf->vport_id, vf->mac);
 		if (rc2) {
 			eth_zero_addr(vf->mac);
-			goto reset_nic;
+			goto reset_nic_up_write;
 		}
 	}
 
 restore_evb_port:
 	rc2 = efx_ef10_evb_port_assign(efx, vf->vport_id, vf_i);
 	if (rc2)
-		goto reset_nic;
+		goto reset_nic_up_write;
 	else
 		vf->vport_assigned = 1;
 
@@ -662,14 +662,16 @@ restore_vadaptor:
 	if (vf->efx) {
 		rc2 = efx_ef10_vadaptor_alloc(vf->efx, EVB_PORT_ID_ASSIGNED);
 		if (rc2)
-			goto reset_nic;
+			goto reset_nic_up_write;
 	}
 
 restore_filters:
 	if (vf->efx) {
 		rc2 = vf->efx->type->filter_table_probe(vf->efx);
 		if (rc2)
-			goto reset_nic;
+			goto reset_nic_up_write;
+
+		up_write(&vf->efx->filter_sem);
 
 		up_write(&vf->efx->filter_sem);
 
@@ -681,9 +683,12 @@ restore_filters:
 	}
 	return rc;
 
+reset_nic_up_write:
+	if (vf->efx)
+		up_write(&vf->efx->filter_sem);
+
 reset_nic:
 	if (vf->efx) {
-		up_write(&vf->efx->filter_sem);
 		netif_err(efx, drv, efx->net_dev,
 			  "Failed to restore VF - scheduling reset.\n");
 		efx_schedule_reset(vf->efx, RESET_TYPE_DATAPATH);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net 1/1] sfc: Ensure down_write(&filter_sem) and up_write() are matched before calling efx_net_open()
  2015-07-08  9:12 [PATCH net 1/1] sfc: Ensure down_write(&filter_sem) and up_write() are matched before calling efx_net_open() Shradha Shah
@ 2015-07-08 23:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-07-08 23:19 UTC (permalink / raw)
  To: sshah; +Cc: netdev, linux-net-drivers

From: Shradha Shah <sshah@solarflare.com>
Date: Wed, 8 Jul 2015 10:12:45 +0100

> This patch avoids the double up_write to filter_sem if
> efx_net_open() fails.
> 
> Resolves: 2d432f20d27c1813a2746008e16dd6ce12a14dc1
> 
> Signed-off-by: Shradha Shah <sshah@solarflare.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-08 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08  9:12 [PATCH net 1/1] sfc: Ensure down_write(&filter_sem) and up_write() are matched before calling efx_net_open() Shradha Shah
2015-07-08 23:19 ` David Miller

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).