OSDN Git Service

net/sonic: Fix receive buffer handling
authorFinn Thain <fthain@telegraphics.com.au>
Wed, 22 Jan 2020 22:07:26 +0000 (09:07 +1100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jan 2020 20:24:37 +0000 (21:24 +0100)
commit9e311820f67e740f4fb8dcb82b4c4b5b05bdd1a5
tree5a55caed3d5df29c52fdede81840fd0c1999f590
parent427db97df1ee721c20bdc9a66db8a9e1da719855
net/sonic: Fix receive buffer handling

The SONIC can sometimes advance its rx buffer pointer (RRP register)
without advancing its rx descriptor pointer (CRDA register). As a result
the index of the current rx descriptor may not equal that of the current
rx buffer. The driver mistakenly assumes that they are always equal.
This assumption leads to incorrect packet lengths and possible packet
duplication. Avoid this by calling a new function to locate the buffer
corresponding to a given descriptor.

Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update")
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/natsemi/sonic.c
drivers/net/ethernet/natsemi/sonic.h