netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xie He <hexie3605@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/net/wan/lapbether.c: Fixed kernel panic when used with AF_PACKET sockets
Date: Tue, 30 Jun 2020 09:01:07 -0700	[thread overview]
Message-ID: <CANJFnSS3XQqa4_Tnur+OhsF-sbCQyP7QBdaikDuUFmuF1ti3rw@mail.gmail.com> (raw)
In-Reply-To: <20200601.113206.2297277969426428314.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Mon, Jun 1, 2020 at 11:32 AM -0700
>
> From: Xie He <hexie3605@gmail.com>
> Date: Wed, 27 May 2020 20:21:33 -0700
>
> > When we use "AF_PACKET" sockets to send data directly over LAPB over
> > Ethernet using this driver, the kernel will panic because of
> > insufficient header space allocated in the "sk_buff" struct.
> >
> > The header space needs 18 bytes because:
> >   the lapbether driver will remove a pseudo header of 1 byte;
> >   the lapb module will prepend the LAPB header of 2 or 3 bytes;
> >   the lapbether driver will prepend a length field of 2 bytes and the
> > Ethernet header of 14 bytes.
> >
> > So -1 + 3 + 16 = 18.
> >
> > Signed-off-by: Xie He <hexie3605@gmail.com>
>
> This is not the real problem.
>
> The real problem is that this is a stacked, layered, device and the
> lapbether driver does not take the inner device's header length into
> consideration.  It should take this from the child device's netdev
> structure rather than use constants.
>
> Your test case will still fail when lapbether is stacked on top of a
> VLAN device or similar, even with your changes.

Thank you for your email! I'm sorry I didn't see your email previously
because of problems with my mailbox.

Yes, you are right. I'll use better ways to improve this and re-submit
my patch. Thanks for pointing this out.

      reply	other threads:[~2020-06-30 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28  3:21 [PATCH] drivers/net/wan/lapbether.c: Fixed kernel panic when used with AF_PACKET sockets Xie He
2020-06-01 18:32 ` David Miller
2020-06-30 16:01   ` Xie He [this message]

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=CANJFnSS3XQqa4_Tnur+OhsF-sbCQyP7QBdaikDuUFmuF1ti3rw@mail.gmail.com \
    --to=hexie3605@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madhuparnabhowmik04@gmail.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 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).