Kaynağa Gözat

[netdevice] Mark devices as open only if opening succeeds

netdev_close() assumes that devices that are open are on the
open_list, which wasn't true if device specific opening failed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Piotr Jaroszyński 13 yıl önce
ebeveyn
işleme
8ab2f51997
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3
    3
      src/net/netdevice.c

+ 3
- 3
src/net/netdevice.c Dosyayı Görüntüle

@@ -463,13 +463,13 @@ int netdev_open ( struct net_device *netdev ) {
463 463
 
464 464
 	DBGC ( netdev, "NETDEV %s opening\n", netdev->name );
465 465
 
466
-	/* Mark as opened */
467
-	netdev->state |= NETDEV_OPEN;
468
-
469 466
 	/* Open the device */
470 467
 	if ( ( rc = netdev->op->open ( netdev ) ) != 0 )
471 468
 		return rc;
472 469
 
470
+	/* Mark as opened */
471
+	netdev->state |= NETDEV_OPEN;
472
+
473 473
 	/* Add to head of open devices list */
474 474
 	list_add ( &netdev->open_list, &open_net_devices );
475 475
 

Loading…
İptal
Kaydet