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.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index f761a9aae4c8..bc4fc30bc85e 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -218,17 +218,6 @@ static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp)
218 return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex); 218 return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex);
219} 219}
220 220
221static inline int set_item(struct pppox_sock *po)
222{
223 int i;
224
225 write_lock_bh(&pppoe_hash_lock);
226 i = __set_item(po);
227 write_unlock_bh(&pppoe_hash_lock);
228
229 return i;
230}
231
232static inline struct pppox_sock *delete_item(unsigned long sid, char *addr, int ifindex) 221static inline struct pppox_sock *delete_item(unsigned long sid, char *addr, int ifindex)
233{ 222{
234 struct pppox_sock *ret; 223 struct pppox_sock *ret;
@@ -595,14 +584,18 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
595 po->pppoe_dev = dev; 584 po->pppoe_dev = dev;
596 po->pppoe_ifindex = dev->ifindex; 585 po->pppoe_ifindex = dev->ifindex;
597 586
598 if (!(dev->flags & IFF_UP)) 587 write_lock_bh(&pppoe_hash_lock);
588 if (!(dev->flags & IFF_UP)){
589 write_unlock_bh(&pppoe_hash_lock);
599 goto err_put; 590 goto err_put;
591 }
600 592
601 memcpy(&po->pppoe_pa, 593 memcpy(&po->pppoe_pa,
602 &sp->sa_addr.pppoe, 594 &sp->sa_addr.pppoe,
603 sizeof(struct pppoe_addr)); 595 sizeof(struct pppoe_addr));
604 596
605 error = set_item(po); 597 error = __set_item(po);
598 write_unlock_bh(&pppoe_hash_lock);
606 if (error < 0) 599 if (error < 0)
607 goto err_put; 600 goto err_put;
608 601