* [PATCH] net: ethernet: dec: tulip: Fix length mask in receive length calculation
@ 2020-02-04 23:01 Moritz Fischer
2020-02-05 13:21 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Moritz Fischer @ 2020-02-04 23:01 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, linux-parisc, mst, hkallweit1, davem, morats,
Moritz Fischer
The receive frame length calculation uses a wrong mask to calculate the
length of the received frames.
Per spec table 4-1 the length is contained in the FL (Frame Length)
field in bits 30:16.
This didn't show up as an issue so far since frames were limited to
1500 bytes which falls within the 11 bit window.
Signed-off-by: Moritz Fischer <mdf@kernel.org>
---
drivers/net/ethernet/dec/tulip/de2104x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
index d305d1b24b0a..42b798a3fad4 100644
--- a/drivers/net/ethernet/dec/tulip/de2104x.c
+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
@@ -417,7 +417,10 @@ static void de_rx (struct de_private *de)
if (status & DescOwn)
break;
- len = ((status >> 16) & 0x7ff) - 4;
+ /* the length is actually a 15 bit value here according
+ * to Table 4-1 in the DE2104x spec so mask is 0x7fff
+ */
+ len = ((status >> 16) & 0x7fff) - 4;
mapping = de->rx_skb[rx_tail].mapping;
if (unlikely(drop)) {
--
2.25.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: ethernet: dec: tulip: Fix length mask in receive length calculation
2020-02-04 23:01 [PATCH] net: ethernet: dec: tulip: Fix length mask in receive length calculation Moritz Fischer
@ 2020-02-05 13:21 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-02-05 13:21 UTC (permalink / raw)
To: mdf; +Cc: netdev, linux-kernel, linux-parisc, mst, hkallweit1, morats
From: Moritz Fischer <mdf@kernel.org>
Date: Tue, 4 Feb 2020 15:01:18 -0800
> The receive frame length calculation uses a wrong mask to calculate the
> length of the received frames.
>
> Per spec table 4-1 the length is contained in the FL (Frame Length)
> field in bits 30:16.
>
> This didn't show up as an issue so far since frames were limited to
> 1500 bytes which falls within the 11 bit window.
>
> Signed-off-by: Moritz Fischer <mdf@kernel.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-05 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 23:01 [PATCH] net: ethernet: dec: tulip: Fix length mask in receive length calculation Moritz Fischer
2020-02-05 13:21 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).