All of lore.kernel.org
 help / color / mirror / Atom feed
From: "François Cachereul" <f.cachereul@alphalink.fr>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: James Chapman <jchapman@katalix.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Subject: Re: BUG in net/l2tp/l2tp_core.c
Date: Thu, 10 Oct 2013 09:37:18 +0200	[thread overview]
Message-ID: <5256592E.3080600@alphalink.fr> (raw)
In-Reply-To: <1381316730.4971.16.camel@edumazet-glaptop.roam.corp.google.com>

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

  reply	other threads:[~2013-10-10  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-09 10:11 BUG in net/l2tp/l2tp_core.c François Cachereul
2013-10-09 11:05 ` Eric Dumazet
2013-10-10  7:37   ` François Cachereul [this message]
2013-10-10 13:30     ` [PATCH] l2tp: must disable bh before calling l2tp_xmit_skb() Eric Dumazet
2013-10-11 21:20       ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5256592E.3080600@alphalink.fr \
    --to=f.cachereul@alphalink.fr \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jchapman@katalix.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.