diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-12-14 15:50:34 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-17 21:59:09 -0800 |
commit | 81dcd1690697efbdf8126e78fbbf7c76d359377f (patch) | |
tree | e4408697d6e40efed6f876b7bcd133fdc93c7eb5 /net/netrom | |
parent | 8d5cf596d10d740b69b5f4bbdb54b85abf75810d (diff) | |
download | linux-81dcd1690697efbdf8126e78fbbf7c76d359377f.tar.bz2 |
[AX.25]: Fix unchecked ax25_listen_register uses
Fix ax25_listen_register to return something that's a sane error code,
then all callers to use it.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netrom')
-rw-r--r-- | net/netrom/nr_dev.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c index 9b8eb54971ab..4700d5225b78 100644 --- a/net/netrom/nr_dev.c +++ b/net/netrom/nr_dev.c @@ -128,25 +128,37 @@ static int nr_header(struct sk_buff *skb, struct net_device *dev, unsigned short return -37; } -static int nr_set_mac_address(struct net_device *dev, void *addr) +static int __must_check nr_set_mac_address(struct net_device *dev, void *addr) { struct sockaddr *sa = addr; + int err; + + if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len)) + return 0; + + if (dev->flags & IFF_UP) { + err = ax25_listen_register((ax25_address *)sa->sa_data, NULL); + if (err) + return err; - if (dev->flags & IFF_UP) ax25_listen_release((ax25_address *)dev->dev_addr, NULL); + } memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); - if (dev->flags & IFF_UP) - ax25_listen_register((ax25_address *)dev->dev_addr, NULL); - return 0; } static int nr_open(struct net_device *dev) { + int err; + + err = ax25_listen_register((ax25_address *)dev->dev_addr, NULL); + if (err) + return err; + netif_start_queue(dev); - ax25_listen_register((ax25_address *)dev->dev_addr, NULL); + return 0; } |