aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pppoe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/pppoe.c')
-rw-r--r--drivers/net/pppoe.c31
1 files changed, 6 insertions, 25 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index a842ecc60a34..9369f811075d 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -85,7 +85,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
85static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb); 85static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb);
86static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb); 86static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb);
87 87
88static struct proto_ops pppoe_ops; 88static const struct proto_ops pppoe_ops;
89static DEFINE_RWLOCK(pppoe_hash_lock); 89static DEFINE_RWLOCK(pppoe_hash_lock);
90 90
91static struct ppp_channel_ops pppoe_chan_ops; 91static struct ppp_channel_ops pppoe_chan_ops;
@@ -383,8 +383,6 @@ static int pppoe_rcv(struct sk_buff *skb,
383{ 383{
384 struct pppoe_hdr *ph; 384 struct pppoe_hdr *ph;
385 struct pppox_sock *po; 385 struct pppox_sock *po;
386 struct sock *sk;
387 int ret;
388 386
389 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) 387 if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
390 goto drop; 388 goto drop;
@@ -395,24 +393,8 @@ static int pppoe_rcv(struct sk_buff *skb,
395 ph = (struct pppoe_hdr *) skb->nh.raw; 393 ph = (struct pppoe_hdr *) skb->nh.raw;
396 394
397 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source); 395 po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source);
398 if (!po) 396 if (po != NULL)
399 goto drop; 397 return sk_receive_skb(sk_pppox(po), skb);
400
401 sk = sk_pppox(po);
402 bh_lock_sock(sk);
403
404 /* Socket state is unknown, must put skb into backlog. */
405 if (sock_owned_by_user(sk) != 0) {
406 sk_add_backlog(sk, skb);
407 ret = NET_RX_SUCCESS;
408 } else {
409 ret = pppoe_rcv_core(sk, skb);
410 }
411
412 bh_unlock_sock(sk);
413 sock_put(sk);
414
415 return ret;
416drop: 398drop:
417 kfree_skb(skb); 399 kfree_skb(skb);
418out: 400out:
@@ -1081,9 +1063,7 @@ static int __init pppoe_proc_init(void)
1081static inline int pppoe_proc_init(void) { return 0; } 1063static inline int pppoe_proc_init(void) { return 0; }
1082#endif /* CONFIG_PROC_FS */ 1064#endif /* CONFIG_PROC_FS */
1083 1065
1084/* ->ioctl are set at pppox_create */ 1066static const struct proto_ops pppoe_ops = {
1085
1086static struct proto_ops pppoe_ops = {
1087 .family = AF_PPPOX, 1067 .family = AF_PPPOX,
1088 .owner = THIS_MODULE, 1068 .owner = THIS_MODULE,
1089 .release = pppoe_release, 1069 .release = pppoe_release,
@@ -1099,7 +1079,8 @@ static struct proto_ops pppoe_ops = {
1099 .getsockopt = sock_no_getsockopt, 1079 .getsockopt = sock_no_getsockopt,
1100 .sendmsg = pppoe_sendmsg, 1080 .sendmsg = pppoe_sendmsg,
1101 .recvmsg = pppoe_recvmsg, 1081 .recvmsg = pppoe_recvmsg,
1102 .mmap = sock_no_mmap 1082 .mmap = sock_no_mmap,
1083 .ioctl = pppox_ioctl,
1103}; 1084};
1104 1085
1105static struct pppox_proto pppoe_proto = { 1086static struct pppox_proto pppoe_proto = {