lkml.org 
[lkml]   [2012]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 09/12] wan/lapbether: check given MAC address, if invalid return -EADDRNOTAVAIL
    Date
    Check if given address is valid in .ndo_set_mac_address/
    lapbeth_set_mac_address(), if invalid return -EADDRNOTAVAIL as
    eth_mac_addr() already does if is_valid_ether_addr() fails.

    Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
    ---
    drivers/net/wan/lapbether.c | 5 +++++
    1 files changed, 5 insertions(+), 0 deletions(-)

    diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
    index 7beeb9b..b6d4cbc 100644
    --- a/drivers/net/wan/lapbether.c
    +++ b/drivers/net/wan/lapbether.c
    @@ -45,6 +45,7 @@
    #include <linux/module.h>
    #include <linux/lapb.h>
    #include <linux/init.h>
    +#include <linux/etherdevice.h>

    #include <net/x25device.h>

    @@ -254,6 +255,10 @@ static void lapbeth_disconnected(struct net_device *dev, int reason)
    static int lapbeth_set_mac_address(struct net_device *dev, void *addr)
    {
    struct sockaddr *sa = addr;
    +
    + if (!is_valid_ether_addr(sa->sa_data))
    + return -EADDRNOTAVAIL;
    +
    memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
    return 0;
    }
    --
    1.7.8.3


    \
     
     \ /
      Last update: 2012-02-24 17:03    [W:0.019 / U:120.704 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site