[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3253541.RgjG7ZtOS4@n95hx1g2>
Date: Wed, 14 Oct 2020 19:02:13 +0200
From: Christian Eggers <ceggers@...i.de>
To: Vladimir Oltean <olteanv@...il.com>
CC: Woojung Huh <woojung.huh@...rochip.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Kurt Kanzenbach <kurt@...utronix.de>
Subject: Re: [PATCH net] net: dsa: ksz: fix padding size of skb
Hi Vladimir,
On Wednesday, 14 October 2020, 18:54:10 CEST, Vladimir Oltean wrote:
> On Wed, Oct 14, 2020 at 07:47:50PM +0300, Vladimir Oltean wrote:
> > On Wed, Oct 14, 2020 at 06:17:19PM +0200, Christian Eggers wrote:
> > > __skb_put_padto() is called in order to ensure a minimal size of the
> > > sk_buff. The required minimal size is ETH_ZLEN + the size required for
> > > the tail tag.
> > >
> > > The current argument misses the size for the tail tag. The expression
> > > "skb->len + padlen" can be simplified to ETH_ZLEN.
> > >
> > > Too small sk_buffs typically result from cloning in
> > > dsa_skb_tx_timestamp(). The cloned sk_buff may not meet the minimum size
> > > requirements.
> > >
> > > Fixes: e71cb9e00922 ("net: dsa: ksz: fix skb freeing")
> > > Signed-off-by: Christian Eggers <ceggers@...i.de>
> > > ---
> >
> > Reviewed-by: Vladimir Oltean <olteanv@...il.com>
>
> Actually no, I take that back.
>
> This statement:
> > The expression "skb->len + padlen" can be simplified to ETH_ZLEN.
>
> is false.
> skb->len + padlen == ETH_ZLEN only if skb->len is less than ETH_ZLEN.
ok, my comment is false.
> Otherwise, skb->len + padlen == skb->len.
>
> Otherwise said, the frame must be padded to
> max(skb->len, ETH_ZLEN) + tail tag length.
At first I thought the same when working on this. But IMHO the padding must
only ensure the minimum required size, there is no need to pad to the "real"
size of the skb. The check for the tailroom above ensures that enough memory
for the "real" size is available.
> So please keep the "skb->len + padlen + len".
>
> Thanks,
> -Vladimir
Best regards
Christian
Powered by blists - more mailing lists