rocker: cleanup vlan table on error adding vlan
authorScott Feldman <sfeldma@gmail.com>
Mon, 1 Jun 2015 18:39:03 +0000 (11:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jun 2015 00:00:08 +0000 (17:00 -0700)
Basic house keeping: If there is an error adding the router MAC for this
vlan, removing the just installed VLAN table entry to leave device in same
state as before failure.

Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/rocker/rocker.c

index b0fb2450912485610ea32da7e57573821645e433..bba9557372a7770b199eefc87ba1ab5745e6a839 100644 (file)
@@ -4320,7 +4320,12 @@ static int rocker_port_vlan_add(struct rocker_port *rocker_port,
        if (err)
                return err;
 
-       return rocker_port_router_mac(rocker_port, trans, 0, htons(vid));
+       err = rocker_port_router_mac(rocker_port, trans, 0, htons(vid));
+       if (err)
+               rocker_port_vlan(rocker_port, trans,
+                                ROCKER_OP_FLAG_REMOVE, vid);
+
+       return err;
 }
 
 static int rocker_port_vlans_add(struct rocker_port *rocker_port,