net: ethernet: Make sure Ethernet header is in the recv pkt
Check that Ethernet header is in the first net_buf fragment. This is very unlikely to happen as device driver is expected to only deliver proper Ethernet frames to upper stack. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
6fcd945f1f
commit
3b64d57943
1 changed files with 6 additions and 1 deletions
|
@ -178,7 +178,12 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
|
|||
struct net_linkaddr *lladdr;
|
||||
sa_family_t family;
|
||||
|
||||
if (hdr == NULL) {
|
||||
/* This expects that the Ethernet header is in the first net_buf
|
||||
* fragment. This is a safe expectation here as it would not make
|
||||
* any sense to split the Ethernet header to two net_buf's by the
|
||||
* Ethernet driver.
|
||||
*/
|
||||
if (hdr == NULL || pkt->buffer->len < hdr_len) {
|
||||
goto drop;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue