diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-12-14 18:50:34 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-18 00:59:09 -0500 |
commit | 81dcd1690697efbdf8126e78fbbf7c76d359377f (patch) | |
tree | e4408697d6e40efed6f876b7bcd133fdc93c7eb5 /net/netrom/nr_dev.c | |
parent | 8d5cf596d10d740b69b5f4bbdb54b85abf75810d (diff) |
[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/nr_dev.c')
-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 | |||
128 | return -37; | 128 | return -37; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int nr_set_mac_address(struct net_device *dev, void *addr) | 131 | static int __must_check nr_set_mac_address(struct net_device *dev, void *addr) |
132 | { | 132 | { |
133 | struct sockaddr *sa = addr; | 133 | struct sockaddr *sa = addr; |
134 | int err; | ||
135 | |||
136 | if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len)) | ||
137 | return 0; | ||
138 | |||
139 | if (dev->flags & IFF_UP) { | ||
140 | err = ax25_listen_register((ax25_address *)sa->sa_data, NULL); | ||
141 | if (err) | ||
142 | return err; | ||
134 | 143 | ||
135 | if (dev->flags & IFF_UP) | ||
136 | ax25_listen_release((ax25_address *)dev->dev_addr, NULL); | 144 | ax25_listen_release((ax25_address *)dev->dev_addr, NULL); |
145 | } | ||
137 | 146 | ||
138 | memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); | 147 | memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); |
139 | 148 | ||
140 | if (dev->flags & IFF_UP) | ||
141 | ax25_listen_register((ax25_address *)dev->dev_addr, NULL); | ||
142 | |||
143 | return 0; | 149 | return 0; |
144 | } | 150 | } |
145 | 151 | ||
146 | static int nr_open(struct net_device *dev) | 152 | static int nr_open(struct net_device *dev) |
147 | { | 153 | { |
154 | int err; | ||
155 | |||
156 | err = ax25_listen_register((ax25_address *)dev->dev_addr, NULL); | ||
157 | if (err) | ||
158 | return err; | ||
159 | |||
148 | netif_start_queue(dev); | 160 | netif_start_queue(dev); |
149 | ax25_listen_register((ax25_address *)dev->dev_addr, NULL); | 161 | |
150 | return 0; | 162 | return 0; |
151 | } | 163 | } |
152 | 164 | ||