VirtualBox

Changeset 31555 in vbox


Ignore:
Timestamp:
Aug 11, 2010 7:14:37 AM (14 years ago)
Author:
vboxsync
Message:

vboxnetadp: sanity check for dev->dev_addr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/linux/VBoxNetAdp-linux.c

    r28800 r31555  
    177177        int err;
    178178
    179         memcpy(pNetDev->dev_addr, pMACAddress, ETH_ALEN);
    180         Log2(("vboxNetAdpOsCreate: pNetDev->dev_addr = %.6Rhxd\n", pNetDev->dev_addr));
    181         err = register_netdev(pNetDev);
    182         if (!err)
     179        if (pNetDev->dev_addr)
    183180        {
    184             strncpy(pThis->szName, pNetDev->name, VBOXNETADP_MAX_NAME_LEN);
    185             pThis->u.s.pNetDev = pNetDev;
    186             Log2(("vboxNetAdpOsCreate: pThis=%p pThis->szName = %p\n", pThis, pThis->szName));
    187             return VINF_SUCCESS;
     181            memcpy(pNetDev->dev_addr, pMACAddress, ETH_ALEN);
     182            Log2(("vboxNetAdpOsCreate: pNetDev->dev_addr = %.6Rhxd\n", pNetDev->dev_addr));
     183            err = register_netdev(pNetDev);
     184            if (!err)
     185            {
     186                strncpy(pThis->szName, pNetDev->name, VBOXNETADP_MAX_NAME_LEN);
     187                pThis->u.s.pNetDev = pNetDev;
     188                Log2(("vboxNetAdpOsCreate: pThis=%p pThis->szName = %p\n", pThis, pThis->szName));
     189                return VINF_SUCCESS;
     190            }
     191        }
     192        else
     193        {
     194            LogRel(("VBoxNetAdp: failed to set MAC address (dev->dev_addr == NULL)\n"));
     195            err = EFAULT;
    188196        }
    189197        free_netdev(pNetDev);
     
    361369    }
    362370    else
    363         LogRel(("VBoxNetFlt: failed to initialize IPRT (rc=%d)\n", rc));
     371        LogRel(("VBoxNetAdp: failed to initialize IPRT (rc=%d)\n", rc));
    364372
    365373    return -RTErrConvertToErrno(rc);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette