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.koski...@nokia.com>
> Signed-off-by: David S. Miller <da...@davemloft.net>
> Signed-off-by: Sasha Levin <sas...@kernel.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 <yuehaib...@huawei.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 <yuehaib...@huawei.com>
    Reviewed-by: Aaro Koskinen <aaro.koski...@nokia.com>
    Signed-off-by: David S. Miller <da...@davemloft.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.

Best regards,
  Nobuhiro

Reply via email to