This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via 42184679185ce0c979e065349360167e3fce6ca0 (commit) from 120e914768f731f18083afd950fba6a6793cca45 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 42184679185ce0c979e065349360167e3fce6ca0 Author: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Date: Wed Aug 30 10:47:45 2017 +0300
helper: chksum: add few guarding conditions
Add few guarding conditions, otherwise bad packet can hang up ODP code. Noted by one of the corner case tests for IPsec.
Signed-off-by: Dmitry Eremin-Solenikov dmitry.ereminsolenikov@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index e0d5c3bf..fb7e5ddc 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -100,10 +100,12 @@ static inline int odph_ipv4_csum(odp_packet_t pkt, odph_ipv4hdr_t *ip, odp_u16sum_t *chksum) { - int nleft = ODPH_IPV4HDR_IHL(ip->ver_ihl) * 4; + unsigned nleft = ODPH_IPV4HDR_IHL(ip->ver_ihl) * 4; uint16_t buf[nleft / 2]; int res;
+ if (odp_unlikely(nleft < sizeof(*ip))) + return -1; ip->chksum = 0; memcpy(buf, ip, sizeof(*ip)); res = odp_packet_copy_to_mem(pkt, offset + sizeof(*ip), @@ -135,7 +137,9 @@ static inline int odph_ipv4_csum_valid(odp_packet_t pkt) if (offset == ODP_PACKET_OFFSET_INVALID) return 0;
- odp_packet_copy_to_mem(pkt, offset, sizeof(odph_ipv4hdr_t), &ip); + res = odp_packet_copy_to_mem(pkt, offset, sizeof(odph_ipv4hdr_t), &ip); + if (odp_unlikely(res < 0)) + return 0;
chksum = ip.chksum;
-----------------------------------------------------------------------
Summary of changes: helper/include/odp/helper/ip.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hooks/post-receive