From: Guillaume Nault <g.nault@alphalink.fr>
To: Denys Fedoryshchenko <nuclearcat@nuclearcat.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Paul Mackerras <paulus@samba.org>,
Oleksii Berezhniak <core@irc.lg.ua>
Subject: Re: [PATCH net] ppp: don't override sk->sk_state in pppoe_flush_dev()
Date: Mon, 5 Oct 2015 14:08:44 +0200 [thread overview]
Message-ID: <20151005120844.GF2911@alphalink.fr> (raw)
In-Reply-To: <356ca8b8094bb2460c0182c00e120378@visp.net.lb>
> I am doing just "dirty" patch like this, i cannot certainly remember if i
> was doing git reversal, because
> it was a while when i spotted this bug. After that pppoe server is not
> rebooting.
>
> diff -Naur linux-4.2.2-vanilla/drivers/net/ppp/pppoe.c
> linux-4.2.2-changed/drivers/net/ppp/pppoe.c
> --- linux-4.2.2-vanilla/drivers/net/ppp/pppoe.c 2015-09-29
> 20:38:27.000000000 +0300
> +++ linux-4.2.2-changed/drivers/net/ppp/pppoe.c 2015-10-04
> 19:05:55.697732991 +0300
> @@ -519,7 +519,7 @@
> }
>
> bh_unlock_sock(sk);
> - if (!schedule_work(&po->proto.pppoe.padt_work))
> +// if (!schedule_work(&po->proto.pppoe.padt_work))
> sock_put(sk);
> }
>
> @@ -633,7 +633,7 @@
>
> lock_sock(sk);
>
> - INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work);
> +// INIT_WORK(&po->proto.pppoe.padt_work, pppoe_unbind_sock_work);
>
> error = -EINVAL;
> if (sp->sa_protocol != PX_PROTO_OE)
>
Ok, so this is clearly related with PADT message handling. Setting
sk->sk_state to PPPOX_ZOMBIE in pppoe_disc_rcv() looks wrong to me.
Furthurmore, at a first glance, it doesn't look necessary. If you're
feeling lucky, you can try the following diff (WARNING: not even
compile-tested!):
if (po) {
struct sock *sk = sk_pppox(po);
- bh_lock_sock(sk);
-
- /* If the user has locked the socket, just ignore
- * the packet. With the way two rcv protocols hook into
- * one socket family type, we cannot (easily) distinguish
- * what kind of SKB it is during backlog rcv.
- */
- if (sock_owned_by_user(sk) == 0) {
- /* We're no longer connect at the PPPOE layer,
- * and must wait for ppp channel to disconnect us.
- */
- sk->sk_state = PPPOX_ZOMBIE;
- }
-
- bh_unlock_sock(sk);
if (!schedule_work(&po->proto.pppoe.padt_work))
sock_put(sk);
}
I'll take a closer look and do proper testing during the week.
next prev parent reply other threads:[~2015-10-05 12:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 9:45 [PATCH net] ppp: don't override sk->sk_state in pppoe_flush_dev() Guillaume Nault
2015-10-02 8:01 ` Denys Fedoryshchenko
2015-10-02 17:54 ` Guillaume Nault
2015-10-04 16:08 ` Denys Fedoryshchenko
2015-10-05 4:08 ` Matt Bennett
2015-10-05 12:24 ` Guillaume Nault
2015-10-06 0:26 ` Matt Bennett
2015-10-06 4:46 ` Matt Bennett
2015-10-06 9:46 ` Guillaume Nault
2015-10-06 21:12 ` Matt Bennett
2015-10-07 10:32 ` Guillaume Nault
2015-10-06 8:50 ` Guillaume Nault
2015-10-05 12:08 ` Guillaume Nault [this message]
2015-10-07 12:12 ` Guillaume Nault
2015-10-13 2:13 ` Denys Fedoryshchenko
2015-10-13 7:24 ` Guillaume Nault
2015-10-22 0:14 ` Matt Bennett
2015-10-22 0:53 ` Denys Fedoryshchenko
2015-10-22 14:49 ` Guillaume Nault
2015-10-05 10:05 ` 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=20151005120844.GF2911@alphalink.fr \
--to=g.nault@alphalink.fr \
--cc=core@irc.lg.ua \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nuclearcat@nuclearcat.com \
--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).