[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 10 Oct 2013 09:37:18 +0200
From: François Cachereul <f.cachereul@...halink.fr>
To: Eric Dumazet <eric.dumazet@...il.com>
CC: James Chapman <jchapman@...alix.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: BUG in net/l2tp/l2tp_core.c
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists