Commit 599d98aa authored by Steven Whitehouse's avatar Steven Whitehouse Committed by David S. Miller

[AX25]: Sanitize ax25 netdevice private handling.

parent be0b01c4
...@@ -333,6 +333,7 @@ struct net_device ...@@ -333,6 +333,7 @@ struct net_device
void *dn_ptr; /* DECnet specific data */ void *dn_ptr; /* DECnet specific data */
void *ip6_ptr; /* IPv6 specific data */ void *ip6_ptr; /* IPv6 specific data */
void *ec_ptr; /* Econet specific data */ void *ec_ptr; /* Econet specific data */
void *ax25_ptr; /* AX.25 specific data */
struct list_head poll_list; /* Link to poll list */ struct list_head poll_list; /* Link to poll list */
int quota; int quota;
......
...@@ -233,7 +233,12 @@ extern void ax25_digi_invert(ax25_digi *, ax25_digi *); ...@@ -233,7 +233,12 @@ extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
/* ax25_dev.c */ /* ax25_dev.c */
extern ax25_dev *ax25_dev_list; extern ax25_dev *ax25_dev_list;
extern spinlock_t ax25_dev_lock; extern spinlock_t ax25_dev_lock;
extern ax25_dev *ax25_dev_ax25dev(struct net_device *);
static inline ax25_dev *ax25_dev_ax25dev(struct net_device *dev)
{
return dev->ax25_ptr;
}
extern ax25_dev *ax25_addr_ax25dev(ax25_address *); extern ax25_dev *ax25_addr_ax25dev(ax25_address *);
extern void ax25_dev_device_up(struct net_device *); extern void ax25_dev_device_up(struct net_device *);
extern void ax25_dev_device_down(struct net_device *); extern void ax25_dev_device_down(struct net_device *);
......
...@@ -34,21 +34,6 @@ ...@@ -34,21 +34,6 @@
ax25_dev *ax25_dev_list; ax25_dev *ax25_dev_list;
spinlock_t ax25_dev_lock = SPIN_LOCK_UNLOCKED; spinlock_t ax25_dev_lock = SPIN_LOCK_UNLOCKED;
ax25_dev *ax25_dev_ax25dev(struct net_device *dev)
{
ax25_dev *ax25_dev, *res = NULL;
spin_lock_bh(&ax25_dev_lock);
for (ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
if (ax25_dev->dev == dev) {
res = ax25_dev;
break;
}
spin_unlock_bh(&ax25_dev_lock);
return res;
}
ax25_dev *ax25_addr_ax25dev(ax25_address *addr) ax25_dev *ax25_addr_ax25dev(ax25_address *addr)
{ {
ax25_dev *ax25_dev, *res = NULL; ax25_dev *ax25_dev, *res = NULL;
...@@ -80,6 +65,7 @@ void ax25_dev_device_up(struct net_device *dev) ...@@ -80,6 +65,7 @@ void ax25_dev_device_up(struct net_device *dev)
memset(ax25_dev, 0x00, sizeof(*ax25_dev)); memset(ax25_dev, 0x00, sizeof(*ax25_dev));
dev->ax25_ptr = ax25_dev;
ax25_dev->dev = dev; ax25_dev->dev = dev;
ax25_dev->forward = NULL; ax25_dev->forward = NULL;
...@@ -152,6 +138,7 @@ void ax25_dev_device_down(struct net_device *dev) ...@@ -152,6 +138,7 @@ void ax25_dev_device_down(struct net_device *dev)
s = s->next; s = s->next;
} }
spin_unlock_bh(&ax25_dev_lock); spin_unlock_bh(&ax25_dev_lock);
dev->ax25_ptr = NULL;
ax25_register_sysctl(); ax25_register_sysctl();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment