Message ID | 1381316730.4971.16.camel@edumazet-glaptop.roam.corp.google.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On 10/09/2013 01:05 PM, Eric Dumazet wrote: > On Wed, 2013-10-09 at 12:11 +0200, François Cachereul wrote: >> Hi, >> >> I got the following BUG when using l2tp modules with smp kernel. >> I noticed that l2tp_xmit_skb uses bh_lock_sock/bh_unlok_sock which >> doesn't seem to be correct because it does a lot of stuff and probably >> sleep before releasing the lock. I try replacing >> bh_lock_sock/bh_unlock_sock with lock_sock/release_sock and the BUG >> doesn't happened anymore. Is it correct ? >> >> Regards >> François >> > > At first glance, you might read commit > 6af88da14ee284aaad6e4326da09a89191ab6165 > ("l2tp: Fix locking in l2tp_core.c") > > l2tp_eth_dev_xmit() is called from BH context, so you cannot use > lock_sock() > > Try the following patch instead : > > diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c > index f0a7ada..ffda81e 100644 > --- a/net/l2tp/l2tp_ppp.c > +++ b/net/l2tp/l2tp_ppp.c > @@ -353,7 +353,9 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh > goto error_put_sess_tun; > } > > + local_bh_disable(); > l2tp_xmit_skb(session, skb, session->hdr_len); > + local_bh_enable(); > > sock_put(ps->tunnel_sock); > sock_put(sk); > @@ -422,7 +424,9 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) > skb->data[0] = ppph[0]; > skb->data[1] = ppph[1]; > > + local_bh_disable(); > l2tp_xmit_skb(session, skb, session->hdr_len); > + local_bh_enable(); > > sock_put(sk_tun); > sock_put(sk); > > That works. Thanks François -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index f0a7ada..ffda81e 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -353,7 +353,9 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh goto error_put_sess_tun; } + local_bh_disable(); l2tp_xmit_skb(session, skb, session->hdr_len); + local_bh_enable(); sock_put(ps->tunnel_sock); sock_put(sk); @@ -422,7 +424,9 @@ static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb) skb->data[0] = ppph[0]; skb->data[1] = ppph[1]; + local_bh_disable(); l2tp_xmit_skb(session, skb, session->hdr_len); + local_bh_enable(); sock_put(sk_tun); sock_put(sk);