From: Guillaume Nault <g.nault@alphalink.fr>
To: fgao@ikuai8.com
Cc: paulus@samba.org, linux-ppp@vger.kernel.org,
netdev@vger.kernel.org, gfree.wind@gmail.com
Subject: Re: [PATCH v2 1/1] ppp: Fix one deadlock issue of PPP when send frame
Date: Wed, 17 Aug 2016 17:42:19 +0000 [thread overview]
Message-ID: <20160817174219.y4opmhj4u77m3ufq@alphalink.fr> (raw)
In-Reply-To: <1471347218-24472-1-git-send-email-fgao@ikuai8.com>
On Tue, Aug 16, 2016 at 07:33:38PM +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> PPP channel holds one spinlock before send frame. But the skb may
> select the same PPP channel with wrong route policy. As a result,
> the skb reaches the same channel path. It tries to get the same
> spinlock which is held before. Bang, the deadlock comes out.
>
Unless I misunderstood the problem you're trying to solve, this patch
doesn't really help: deadlock still occurs if the same IP is used for
L2TP and PPP's peer address.
> Now add one lock owner to avoid it like xmit_lock_owner of
> netdev_queue. Check the lock owner before try to get the spinlock.
> If the current cpu is already the owner, needn't lock again. When
> PPP channel holds the spinlock at the first time, it sets owner
> with current CPU ID.
>
I think you should forbid lock recursion entirely, and drop the packet
if the owner tries to re-acquire the channel lock. Otherwise you just
move the deadlock down the stack (l2tp_xmit_skb() can't be called
recursively).
> diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
> index 70cfa06..6909ab1 100644
> --- a/drivers/net/ppp/ppp_generic.c
> +++ b/drivers/net/ppp/ppp_generic.c
> @@ -162,6 +162,37 @@ struct ppp {
> |SC_MULTILINK|SC_MP_SHORTSEQ|SC_MP_XSHORTSEQ \
> |SC_COMP_TCP|SC_REJ_COMP_TCP|SC_MUST_COMP)
>
> +struct chennel_lock {
^
I guess you meant 'channel_lock'.
> + spinlock_t lock;
> + u32 owner;
This field's default value is -1. So why not declaring it as 'int'?
next prev parent reply other threads:[~2016-08-17 17:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-16 11:33 [PATCH v2 1/1] ppp: Fix one deadlock issue of PPP when send frame fgao
2016-08-17 17:42 ` Guillaume Nault [this message]
2016-08-18 0:58 ` Feng Gao
2016-08-18 16:13 ` Guillaume Nault
2016-08-18 22:52 ` Feng Gao
2016-08-19 21:57 ` Guillaume Nault
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=20160817174219.y4opmhj4u77m3ufq@alphalink.fr \
--to=g.nault@alphalink.fr \
--cc=fgao@ikuai8.com \
--cc=gfree.wind@gmail.com \
--cc=linux-ppp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).