ibmvnic: Set to CLOSED state even on error
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Thu, 11 Feb 2021 01:41:43 +0000 (17:41 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:37:30 +0000 (11:37 +0100)
[ Upstream commit d4083d3c00f60a09ad82e3bf17ff57fec69c8aa6 ]

If set_link_state() fails for any reason, we still cleanup the adapter
state and cannot recover from a partial close anyway. So set the adapter
to CLOSED state. That way if a new soft/hard reset is processed, the
adapter will remain in the CLOSED state until the next ibmvnic_open().

Fixes: 01d9bd792d16 ("ibmvnic: Reorganize device close")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Reported-by: Abdul Haleem <abdhalee@in.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/ibm/ibmvnic.c

index ee16e0e..d789c3c 100644 (file)
@@ -1329,10 +1329,8 @@ static int __ibmvnic_close(struct net_device *netdev)
 
        adapter->state = VNIC_CLOSING;
        rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
-       if (rc)
-               return rc;
        adapter->state = VNIC_CLOSED;
-       return 0;
+       return rc;
 }
 
 static int ibmvnic_close(struct net_device *netdev)