net/tap: add buffer overflow checks before checksum
authorBruce Richardson <bruce.richardson@intel.com>
Mon, 17 Dec 2018 15:50:05 +0000 (15:50 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 21 Dec 2018 15:22:41 +0000 (16:22 +0100)
commit1168a4fd193c3bf981c4889cba150a7bb4c1d169
tree4d72b76c64172d4209dc62727150bbf3be0dc543
parent8743d499a59c3d6a7c743861fd3baf06ed5fe763
net/tap: add buffer overflow checks before checksum

The checksum calculation APIs take only the packet headers pointers as
parameters, so they assume that the lengths reported in those headers
are correct. However, a malicious packet could claim to be far larger
than it is, so we need to check the header lengths in the driver before
calling the checksum API.

A better fix would be to allow the lengths to be passed into the API
function, but that would be an API break, so fixing in TAP driver for
now.

Fixes: 8ae3023387e9 ("net/tap: add Rx/Tx checksum offload support")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
drivers/net/tap/rte_eth_tap.c