diff options
author | Dean Jenkins <Dean_Jenkins@mentor.com> | 2015-10-02 13:29:07 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-05 13:58:43 (GMT) |
commit | 3f30b158eba5c604b6e0870027eef5d19fc9271d (patch) | |
tree | 95a924fc00afec6805f16856c5ff092b1e71a1e0 /drivers/net/usb/asix_devices.c | |
parent | 9a5ccd8e039eef53336e45d01c7d8a1acbd36b47 (diff) | |
download | linux-3f30b158eba5c604b6e0870027eef5d19fc9271d.tar.xz |
asix: On RX avoid creating bad Ethernet frames
When RX Ethernet frames span multiple URB socket buffers,
the data stream may suffer a discontinuity which will cause
the current Ethernet frame in the netdev socket buffer
to be incomplete. This frame needs to be discarded instead
of appending unrelated data from the current URB socket buffer
to the Ethernet frame in the netdev socket buffer. This avoids
creating a corrupted Ethernet frame in the netdev socket buffer.
A discontinuity can occur when the previous URB socket buffer
held an incomplete Ethernet frame due to truncation or a
URB socket buffer containing the end of the Ethernet frame
was missing.
Therefore, add a sanity test for when an Ethernet frame
spans multiple URB socket buffers to check that the remaining
bytes of the currently received Ethernet frame point to
a good Data header 32-bit word of the next Ethernet
frame. Upon error, reset the remaining bytes variable to
zero and discard the current netdev socket buffer.
Assume that the Data header is located at the start of
the current socket buffer and attempt to process the next
Ethernet frame from there. This avoids unnecessarily
discarding a good URB socket buffer that contains a new
Ethernet frame.
Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: Mark Craske <Mark_Craske@mentor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/asix_devices.c')
0 files changed, 0 insertions, 0 deletions