aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2006-12-14 18:51:44 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-18 00:59:13 -0500
commita159aaa328a02b0189774c58ae7d917b25d26852 (patch)
treefb6ff985dd37d37e7e20bc3f5caf4ce515b40d34 /net
parenta4282717c102aef2bfab1d947c392de4d8abc0ec (diff)
[AX.25]: Fix unchecked rose_add_loopback_node uses
Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/rose/rose_dev.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index 7c279e2659ec..50824d345fa6 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -93,20 +93,34 @@ static int rose_rebuild_header(struct sk_buff *skb)
93static int rose_set_mac_address(struct net_device *dev, void *addr) 93static int rose_set_mac_address(struct net_device *dev, void *addr)
94{ 94{
95 struct sockaddr *sa = addr; 95 struct sockaddr *sa = addr;
96 int err;
96 97
97 rose_del_loopback_node((rose_address *)dev->dev_addr); 98 if (!memcpy(dev->dev_addr, sa->sa_data, dev->addr_len))
99 return 0;
98 100
99 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); 101 if (dev->flags & IFF_UP) {
102 err = rose_add_loopback_node((rose_address *)dev->dev_addr);
103 if (err)
104 return err;
105
106 rose_del_loopback_node((rose_address *)dev->dev_addr);
107 }
100 108
101 rose_add_loopback_node((rose_address *)dev->dev_addr); 109 memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
102 110
103 return 0; 111 return 0;
104} 112}
105 113
106static int rose_open(struct net_device *dev) 114static int rose_open(struct net_device *dev)
107{ 115{
116 int err;
117
118 err = rose_add_loopback_node((rose_address *)dev->dev_addr);
119 if (err)
120 return err;
121
108 netif_start_queue(dev); 122 netif_start_queue(dev);
109 rose_add_loopback_node((rose_address *)dev->dev_addr); 123
110 return 0; 124 return 0;
111} 125}
112 126