[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>
This commit is contained in:
committed by
David S. Miller
parent
8d5cf596d1
commit
81dcd16906
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user