* [dpdk-stable] [PATCH] examples/ipsec-secgw: fix ip version check
@ 2017-10-13 12:50 Tomasz Duszynski
2017-10-16 9:56 ` [dpdk-stable] [dpdk-dev] " Sergio Gonzalez Monroy
0 siblings, 1 reply; 4+ messages in thread
From: Tomasz Duszynski @ 2017-10-13 12:50 UTC (permalink / raw)
To: dev; +Cc: Tomasz Duszynski, stable
Since new_ip and ip4 are overlapping buffers copying ip4 over new_ip
using memmove() might overwrite memory at ip4. This could happen if
following condition holds:
ip_hdr_len > sizeof(struct esp_hdr) + sa->iv_len
Thus using ip4 to check ip version is wrong as it might not contain
proper value.
Fixes: f159e70b0922 ("examples/ipsec-secgw: support transport mode")
Cc: stable@dpdk.org
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
examples/ipsec-secgw/esp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
index 2897840..063e63f 100644
--- a/examples/ipsec-secgw/esp.c
+++ b/examples/ipsec-secgw/esp.c
@@ -307,8 +307,8 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
sizeof(struct esp_hdr) + sa->iv_len);
memmove(new_ip, ip4, ip_hdr_len);
esp = (struct esp_hdr *)(new_ip + ip_hdr_len);
+ ip4 = (struct ip *)new_ip;
if (likely(ip4->ip_v == IPVERSION)) {
- ip4 = (struct ip *)new_ip;
ip4->ip_p = IPPROTO_ESP;
ip4->ip_len = htons(rte_pktmbuf_data_len(m));
} else {
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/ipsec-secgw: fix ip version check
2017-10-13 12:50 [dpdk-stable] [PATCH] examples/ipsec-secgw: fix ip version check Tomasz Duszynski
@ 2017-10-16 9:56 ` Sergio Gonzalez Monroy
2017-10-16 10:43 ` Aviad Yehezkel
2017-10-16 14:46 ` De Lara Guarch, Pablo
0 siblings, 2 replies; 4+ messages in thread
From: Sergio Gonzalez Monroy @ 2017-10-16 9:56 UTC (permalink / raw)
To: Tomasz Duszynski, dev; +Cc: stable
On 13/10/2017 13:50, Tomasz Duszynski wrote:
> Since new_ip and ip4 are overlapping buffers copying ip4 over new_ip
> using memmove() might overwrite memory at ip4. This could happen if
> following condition holds:
>
> ip_hdr_len > sizeof(struct esp_hdr) + sa->iv_len
>
> Thus using ip4 to check ip version is wrong as it might not contain
> proper value.
>
> Fixes: f159e70b0922 ("examples/ipsec-secgw: support transport mode")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> ---
> examples/ipsec-secgw/esp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
> index 2897840..063e63f 100644
> --- a/examples/ipsec-secgw/esp.c
> +++ b/examples/ipsec-secgw/esp.c
> @@ -307,8 +307,8 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,
> sizeof(struct esp_hdr) + sa->iv_len);
> memmove(new_ip, ip4, ip_hdr_len);
> esp = (struct esp_hdr *)(new_ip + ip_hdr_len);
> + ip4 = (struct ip *)new_ip;
> if (likely(ip4->ip_v == IPVERSION)) {
> - ip4 = (struct ip *)new_ip;
> ip4->ip_p = IPPROTO_ESP;
> ip4->ip_len = htons(rte_pktmbuf_data_len(m));
> } else {
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/ipsec-secgw: fix ip version check
2017-10-16 9:56 ` [dpdk-stable] [dpdk-dev] " Sergio Gonzalez Monroy
@ 2017-10-16 10:43 ` Aviad Yehezkel
2017-10-16 14:46 ` De Lara Guarch, Pablo
1 sibling, 0 replies; 4+ messages in thread
From: Aviad Yehezkel @ 2017-10-16 10:43 UTC (permalink / raw)
To: Sergio Gonzalez Monroy, Tomasz Duszynski, dev; +Cc: stable
Reviewed-by: Aviad Yehezkel <aviadye@mellanox.com>
On 10/16/2017 12:56 PM, Sergio Gonzalez Monroy wrote:
> On 13/10/2017 13:50, Tomasz Duszynski wrote:
>> Since new_ip and ip4 are overlapping buffers copying ip4 over new_ip
>> using memmove() might overwrite memory at ip4. This could happen if
>> following condition holds:
>>
>> ip_hdr_len > sizeof(struct esp_hdr) + sa->iv_len
>>
>> Thus using ip4 to check ip version is wrong as it might not contain
>> proper value.
>>
>> Fixes: f159e70b0922 ("examples/ipsec-secgw: support transport mode")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
>> ---
>> examples/ipsec-secgw/esp.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
>> index 2897840..063e63f 100644
>> --- a/examples/ipsec-secgw/esp.c
>> +++ b/examples/ipsec-secgw/esp.c
>> @@ -307,8 +307,8 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa
>> *sa,
>> sizeof(struct esp_hdr) + sa->iv_len);
>> memmove(new_ip, ip4, ip_hdr_len);
>> esp = (struct esp_hdr *)(new_ip + ip_hdr_len);
>> + ip4 = (struct ip *)new_ip;
>> if (likely(ip4->ip_v == IPVERSION)) {
>> - ip4 = (struct ip *)new_ip;
>> ip4->ip_p = IPPROTO_ESP;
>> ip4->ip_len = htons(rte_pktmbuf_data_len(m));
>> } else {
>
> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/ipsec-secgw: fix ip version check
2017-10-16 9:56 ` [dpdk-stable] [dpdk-dev] " Sergio Gonzalez Monroy
2017-10-16 10:43 ` Aviad Yehezkel
@ 2017-10-16 14:46 ` De Lara Guarch, Pablo
1 sibling, 0 replies; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-16 14:46 UTC (permalink / raw)
To: Gonzalez Monroy, Sergio, Tomasz Duszynski, dev; +Cc: stable
> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Sergio
> Gonzalez Monroy
> Sent: Monday, October 16, 2017 10:57 AM
> To: Tomasz Duszynski <tdu@semihalf.com>; dev@dpdk.org
> Cc: stable@dpdk.org
> Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/ipsec-secgw: fix ip
> version check
>
> On 13/10/2017 13:50, Tomasz Duszynski wrote:
> > Since new_ip and ip4 are overlapping buffers copying ip4 over new_ip
> > using memmove() might overwrite memory at ip4. This could happen if
> > following condition holds:
> >
> > ip_hdr_len > sizeof(struct esp_hdr) + sa->iv_len
> >
> > Thus using ip4 to check ip version is wrong as it might not contain
> > proper value.
> >
> > Fixes: f159e70b0922 ("examples/ipsec-secgw: support transport mode")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> > ---
> > examples/ipsec-secgw/esp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c
> > index 2897840..063e63f 100644
> > --- a/examples/ipsec-secgw/esp.c
> > +++ b/examples/ipsec-secgw/esp.c
> > @@ -307,8 +307,8 @@ esp_outbound(struct rte_mbuf *m, struct
> ipsec_sa *sa,
> > sizeof(struct esp_hdr) + sa->iv_len);
> > memmove(new_ip, ip4, ip_hdr_len);
> > esp = (struct esp_hdr *)(new_ip + ip_hdr_len);
> > + ip4 = (struct ip *)new_ip;
> > if (likely(ip4->ip_v == IPVERSION)) {
> > - ip4 = (struct ip *)new_ip;
> > ip4->ip_p = IPPROTO_ESP;
> > ip4->ip_len = htons(rte_pktmbuf_data_len(m));
> > } else {
>
> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Applied to dpdk-next-crypto.
Thanks,
Pablo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-16 14:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 12:50 [dpdk-stable] [PATCH] examples/ipsec-secgw: fix ip version check Tomasz Duszynski
2017-10-16 9:56 ` [dpdk-stable] [dpdk-dev] " Sergio Gonzalez Monroy
2017-10-16 10:43 ` Aviad Yehezkel
2017-10-16 14:46 ` De Lara Guarch, Pablo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).