Ticket #10183: 0001-Check-if-device-exists-before-creating-ethernet-inte.patch

File 0001-Check-if-device-exists-before-creating-ethernet-inte.patch, 985 bytes (added by jackburton, 11 years ago)

Proposed patch

  • src/add-ons/kernel/network/devices/ethernet/ethernet.cpp

    From d8cb91e2a4a2cb2ad30f967c6ca5d67f0eda73b8 Mon Sep 17 00:00:00 2001
    From: Stefano Ceccherini <stefano.ceccherini@gmail.com>
    Date: Sat, 9 Nov 2013 20:43:23 +0100
    Subject: [PATCH] Check if device exists before creating ethernet interface.
     Fix ticket #10183.
    
    ---
     .../kernel/network/devices/ethernet/ethernet.cpp   |    3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp b/src/add-ons/kernel/network/devices/ethernet/ethernet.cpp
    index 47c701e..d989075 100644
    a b ethernet_init(const char *name, net_device **_device)  
    124124        || !strcmp(name, "/dev/net/userland_server"))
    125125        return B_BAD_VALUE;
    126126
     127    if (access(name, F_OK) != 0)
     128        return errno;
     129
    127130    status_t status = get_module(NET_BUFFER_MODULE_NAME, (module_info **)&gBufferModule);
    128131    if (status < B_OK)
    129132        return status;