git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
drm/radeon/kms: make sure LVDS panel is valid in detect()
[safe/jmp/linux-2.6]
/
net
/
econet
/
af_econet.c
diff --git
a/net/econet/af_econet.c
b/net/econet/af_econet.c
index
7de3006
..
f0bbc57
100644
(file)
--- a/
net/econet/af_econet.c
+++ b/
net/econet/af_econet.c
@@
-336,10
+336,11
@@
static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
/* Real hardware Econet. We're not worthy etc. */
#ifdef CONFIG_ECONET_NATIVE
unsigned short proto = 0;
/* Real hardware Econet. We're not worthy etc. */
#ifdef CONFIG_ECONET_NATIVE
unsigned short proto = 0;
+ int res;
dev_hold(dev);
dev_hold(dev);
- skb = sock_alloc_send_skb(sk, len+LL_
RESERV
ED_SPACE(dev),
+ skb = sock_alloc_send_skb(sk, len+LL_
ALLOCAT
ED_SPACE(dev),
msg->msg_flags & MSG_DONTWAIT, &err);
if (skb==NULL)
goto out_unlock;
msg->msg_flags & MSG_DONTWAIT, &err);
if (skb==NULL)
goto out_unlock;
@@
-354,12
+355,12
@@
static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
eb->sec = *saddr;
eb->sent = ec_tx_done;
eb->sec = *saddr;
eb->sent = ec_tx_done;
- if (dev->hard_header) {
- int res;
+ err = -EINVAL;
+ res = dev_hard_header(skb, dev, ntohs(proto), &addr, NULL, len);
+ if (res < 0)
+ goto out_free;
+ if (res > 0) {
struct ec_framehdr *fh;
struct ec_framehdr *fh;
- err = -EINVAL;
- res = dev->hard_header(skb, dev, ntohs(proto),
- &addr, NULL, len);
/* Poke in our control byte and
port number. Hack, hack. */
fh = (struct ec_framehdr *)(skb->data);
/* Poke in our control byte and
port number. Hack, hack. */
fh = (struct ec_framehdr *)(skb->data);
@@
-368,8
+369,7
@@
static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
if (sock->type != SOCK_DGRAM) {
skb_reset_tail_pointer(skb);
skb->len = 0;
if (sock->type != SOCK_DGRAM) {
skb_reset_tail_pointer(skb);
skb->len = 0;
- } else if (res < 0)
- goto out_free;
+ }
}
/* Copy the data. Returns -EFAULT on error */
}
/* Copy the data. Returns -EFAULT on error */
@@
-520,6
+520,7
@@
static int econet_getname(struct socket *sock, struct sockaddr *uaddr,
if (peer)
return -EOPNOTSUPP;
if (peer)
return -EOPNOTSUPP;
+ memset(sec, 0, sizeof(*sec));
mutex_lock(&econet_mutex);
sk = sock->sk;
mutex_lock(&econet_mutex);
sk = sock->sk;
@@
-540,8
+541,7
@@
static void econet_destroy_timer(unsigned long data)
{
struct sock *sk=(struct sock *)data;
{
struct sock *sk=(struct sock *)data;
- if (!atomic_read(&sk->sk_wmem_alloc) &&
- !atomic_read(&sk->sk_rmem_alloc)) {
+ if (!sk_has_allocations(sk)) {
sk_free(sk);
return;
}
sk_free(sk);
return;
}
@@
-573,16
+573,13
@@
static int econet_release(struct socket *sock)
sk->sk_state_change(sk); /* It is useless. Just for sanity. */
sk->sk_state_change(sk); /* It is useless. Just for sanity. */
- sock->sk = NULL;
- sk->sk_socket = NULL;
- sock_set_flag(sk, SOCK_DEAD);
+ sock_orphan(sk);
/* Purge queues */
skb_queue_purge(&sk->sk_receive_queue);
/* Purge queues */
skb_queue_purge(&sk->sk_receive_queue);
- if (atomic_read(&sk->sk_rmem_alloc) ||
- atomic_read(&sk->sk_wmem_alloc)) {
+ if (sk_has_allocations(sk)) {
sk->sk_timer.data = (unsigned long)sk;
sk->sk_timer.expires = jiffies + HZ;
sk->sk_timer.function = econet_destroy_timer;
sk->sk_timer.data = (unsigned long)sk;
sk->sk_timer.expires = jiffies + HZ;
sk->sk_timer.function = econet_destroy_timer;
@@
-624,7
+621,7
@@
static int econet_create(struct net *net, struct socket *sock, int protocol)
sock->state = SS_UNCONNECTED;
err = -ENOBUFS;
sock->state = SS_UNCONNECTED;
err = -ENOBUFS;
- sk = sk_alloc(net, PF_ECONET, GFP_KERNEL, &econet_proto
, 1
);
+ sk = sk_alloc(net, PF_ECONET, GFP_KERNEL, &econet_proto);
if (sk == NULL)
goto out;
if (sk == NULL)
goto out;
@@
-662,7
+659,7
@@
static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg)
if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
return -EFAULT;
if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
return -EFAULT;
- if ((dev = dev_get_by_name(ifr.ifr_name)) == NULL)
+ if ((dev = dev_get_by_name(
&init_net,
ifr.ifr_name)) == NULL)
return -ENODEV;
sec = (struct sockaddr_ec *)&ifr.ifr_addr;
return -ENODEV;
sec = (struct sockaddr_ec *)&ifr.ifr_addr;
@@
-903,15
+900,10
@@
static void aun_tx_ack(unsigned long seq, int result)
struct ec_cb *eb;
spin_lock_irqsave(&aun_queue_lock, flags);
struct ec_cb *eb;
spin_lock_irqsave(&aun_queue_lock, flags);
- skb = skb_peek(&aun_queue);
- while (skb && skb != (struct sk_buff *)&aun_queue)
- {
- struct sk_buff *newskb = skb->next;
+ skb_queue_walk(&aun_queue, skb) {
eb = (struct ec_cb *)&skb->cb;
if (eb->seq == seq)
goto foundit;
eb = (struct ec_cb *)&skb->cb;
if (eb->seq == seq)
goto foundit;
-
- skb = newskb;
}
spin_unlock_irqrestore(&aun_queue_lock, flags);
printk(KERN_DEBUG "AUN: unknown sequence %ld\n", seq);
}
spin_unlock_irqrestore(&aun_queue_lock, flags);
printk(KERN_DEBUG "AUN: unknown sequence %ld\n", seq);
@@
-984,23
+976,18
@@
static void aun_data_available(struct sock *sk, int slen)
static void ab_cleanup(unsigned long h)
{
static void ab_cleanup(unsigned long h)
{
- struct sk_buff *skb;
+ struct sk_buff *skb
, *n
;
unsigned long flags;
spin_lock_irqsave(&aun_queue_lock, flags);
unsigned long flags;
spin_lock_irqsave(&aun_queue_lock, flags);
- skb = skb_peek(&aun_queue);
- while (skb && skb != (struct sk_buff *)&aun_queue)
- {
- struct sk_buff *newskb = skb->next;
+ skb_queue_walk_safe(&aun_queue, skb, n) {
struct ec_cb *eb = (struct ec_cb *)&skb->cb;
struct ec_cb *eb = (struct ec_cb *)&skb->cb;
- if ((jiffies - eb->start) > eb->timeout)
- {
+ if ((jiffies - eb->start) > eb->timeout) {
tx_result(skb->sk, eb->cookie,
ECTYPE_TRANSMIT_NOT_PRESENT);
skb_unlink(skb, &aun_queue);
kfree_skb(skb);
}
tx_result(skb->sk, eb->cookie,
ECTYPE_TRANSMIT_NOT_PRESENT);
skb_unlink(skb, &aun_queue);
kfree_skb(skb);
}
- skb = newskb;
}
spin_unlock_irqrestore(&aun_queue_lock, flags);
}
spin_unlock_irqrestore(&aun_queue_lock, flags);
@@
-1014,9
+1001,8
@@
static int __init aun_udp_initialise(void)
skb_queue_head_init(&aun_queue);
spin_lock_init(&aun_queue_lock);
skb_queue_head_init(&aun_queue);
spin_lock_init(&aun_queue_lock);
-
init_timer(&ab_cleanup_timer
);
+
setup_timer(&ab_cleanup_timer, ab_cleanup, 0
);
ab_cleanup_timer.expires = jiffies + (HZ*2);
ab_cleanup_timer.expires = jiffies + (HZ*2);
- ab_cleanup_timer.function = ab_cleanup;
add_timer(&ab_cleanup_timer);
memset(&sin, 0, sizeof(sin));
add_timer(&ab_cleanup_timer);
memset(&sin, 0, sizeof(sin));
@@
-1065,7
+1051,7
@@
static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
struct sock *sk;
struct ec_device *edev = dev->ec_ptr;
struct sock *sk;
struct ec_device *edev = dev->ec_ptr;
- if (
dev->nd_net != &init_net
)
+ if (
!net_eq(dev_net(dev), &init_net)
)
goto drop;
if (skb->pkt_type == PACKET_OTHERHOST)
goto drop;
if (skb->pkt_type == PACKET_OTHERHOST)
@@
-1105,8
+1091,8
@@
drop:
return NET_RX_DROP;
}
return NET_RX_DROP;
}
-static struct packet_type econet_packet_type = {
- .type =
__constant_htons
(ETH_P_ECONET),
+static struct packet_type econet_packet_type
__read_mostly
= {
+ .type =
cpu_to_be16
(ETH_P_ECONET),
.func = econet_rcv,
};
.func = econet_rcv,
};
@@
-1122,6
+1108,9
@@
static int econet_notifier(struct notifier_block *this, unsigned long msg, void
struct net_device *dev = (struct net_device *)data;
struct ec_device *edev;
struct net_device *dev = (struct net_device *)data;
struct ec_device *edev;
+ if (!net_eq(dev_net(dev), &init_net))
+ return NOTIFY_DONE;
+
switch (msg) {
case NETDEV_UNREGISTER:
/* A device has gone down - kill any data we hold for it. */
switch (msg) {
case NETDEV_UNREGISTER:
/* A device has gone down - kill any data we hold for it. */