lkml.org 
[lkml]   [2019]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@nokia.com>
> > Signed-off-by: David S. Miller <davem@davemloft.net>
> > Signed-off-by: Sasha Levin <sashal@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 <yuehaibing@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 <yuehaibing@huawei.com>
> Reviewed-by: Aaro Koskinen <aaro.koskinen@nokia.com>
> Signed-off-by: David S. Miller <davem@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.

Thanks, now queued up.

greg k-h

\
 
 \ /
  Last update: 2019-05-08 08:36    [W:0.147 / U:1.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site