Re: [PATCH 4.19 38/99] net: stmmac: use correct DMA buffer size in the RX descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
> ---
>  .../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@xxxxxxxxxx>
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@xxxxxxxxxx>
    Reviewed-by: Aaro Koskinen <aaro.koskinen@xxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

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



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux