[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJht_ENaDzwwtqupZf=pK4MBUsU1=OdXO=TRVn0a44YxC5U1SQ@mail.gmail.com>
Date: Mon, 13 Jul 2020 15:19:40 -0700
From: Xie He <xie.he.0141@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Shannon Nelson <snelson@...sando.io>,
Martin Habets <mhabets@...arflare.com>,
"Michael S. Tsirkin" <mst@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-x25@...r.kernel.org
Subject: Re: [PATCH] drivers/net/wan/x25_asy: Fix to make it work
On Mon, Jul 13, 2020 at 2:21 PM Eric Dumazet <eric.dumazet@...il.com> wrote:
>
> It is not clear to me what guarantee we have to have one byte of headroom in the skb
> at this point.
>
> You might add to be safe : (as done in lapbeth_data_indication(), but after the skb_push() which seems wrong)
>
> if (skb_cow(skb, 1)) {
> kfree_skb(skb); /* This line I am not sure, but looking at
> * lapb_data_indication() this might be needed.
> */
> return NET_RX_DROP;
> }
>
Thank you for your review, Eric!
The function "x25_asy_data_indication" is called by the "lapb" module
(net/lapb/). Before the "lapb" module calls this function, it has
removed from the skb an LAPB header which is at least 2 bytes (in the
function "lapb_decode"). So I thought there would always be a headroom
of one byte at this point.
But yes, it is always safer to add "skb_cow" at this point, so that it
is clearer the code would not crash here. I'll add it in the second
version of this patch. Thank you for your suggestion!
And yes, I agree that in "lapbeth_data_indication", the order of
"skb_push" and "skb_cow" is probably wrong. Let us submit another
patch to fix this problem!
Powered by blists - more mailing lists