[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190508063550.GA28651@kroah.com>
Date: Wed, 8 May 2019 08:35:50 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@...hiba.co.jp>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Aaro Koskinen <aaro.koskinen@...ia.com>,
"David S. Miller" <davem@...emloft.net>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 4.19 38/99] net: stmmac: use correct DMA buffer size in
the RX descriptor
On Wed, May 08, 2019 at 09:10:14AM +0900, Nobuhiro Iwamatsu wrote:
> Hi,
>
> On Mon, May 06, 2019 at 04:32:11PM +0200, Greg Kroah-Hartman wrote:
> > [ Upstream commit 583e6361414903c5206258a30e5bd88cb03c0254 ]
> >
> > We always program the maximum DMA buffer size into the receive descriptor,
> > although the allocated size may be less. E.g. with the default MTU size
> > we allocate only 1536 bytes. If somebody sends us a bigger frame, then
> > memory may get corrupted.
> >
> > Fix by using exact buffer sizes.
> >
> > Signed-off-by: Aaro Koskinen <aaro.koskinen@...ia.com>
> > Signed-off-by: David S. Miller <davem@...emloft.net>
> > Signed-off-by: Sasha Levin <sashal@...nel.org>
> > ---
> > .../net/ethernet/stmicro/stmmac/descs_com.h | 22 ++++++++++++-------
> > .../ethernet/stmicro/stmmac/dwmac4_descs.c | 2 +-
> > .../ethernet/stmicro/stmmac/dwxgmac2_descs.c | 2 +-
> > .../net/ethernet/stmicro/stmmac/enh_desc.c | 10 ++++++---
> > drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +-
> > .../net/ethernet/stmicro/stmmac/norm_desc.c | 10 ++++++---
> > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--
>
> This commit is incomplete and we need the following commit:
>
> commit f87db4dbd52f2f8a170a2b51cb0926221ca7c9e2
> Author: YueHaibing <yuehaibing@...wei.com>
> Date: Wed Apr 17 09:49:39 2019 +0800
>
> net: stmmac: Use bfsize1 in ndesc_init_rx_desc
>
> gcc warn this:
>
> drivers/net/ethernet/stmicro/stmmac/norm_desc.c: In function ndesc_init_rx_desc:
> drivers/net/ethernet/stmicro/stmmac/norm_desc.c:138:6: warning: variable 'bfsize1' set but not used [-Wunused-but-set-variable]
>
> Like enh_desc_init_rx_desc, we should use bfsize1
> in ndesc_init_rx_desc to calculate 'p->des1'
>
> Fixes: 583e63614149 ("net: stmmac: use correct DMA buffer size in the RX descriptor")
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>
> Reviewed-by: Aaro Koskinen <aaro.koskinen@...ia.com>
> Signed-off-by: David S. Miller <davem@...emloft.net>
>
> And this fix is also needed for 5.0.14-rc.
> Please apply this commit to 4.19.y-rc and 5.0.y-rc.
Thanks, now queued up.
greg k-h
Powered by blists - more mailing lists