From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id DCC141B5F7; Mon, 16 Oct 2017 11:56:51 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP; 16 Oct 2017 02:56:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,386,1503385200"; d="scan'208";a="146932236" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.252.25.241]) ([10.252.25.241]) by orsmga002.jf.intel.com with ESMTP; 16 Oct 2017 02:56:48 -0700 To: Tomasz Duszynski , dev@dpdk.org References: <1507899009-20393-1-git-send-email-tdu@semihalf.com> Cc: stable@dpdk.org From: Sergio Gonzalez Monroy Message-ID: <89f28ab9-22c1-977e-c986-d691408d9a78@intel.com> Date: Mon, 16 Oct 2017 10:56:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1507899009-20393-1-git-send-email-tdu@semihalf.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] examples/ipsec-secgw: fix ip version check X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Oct 2017 09:56:52 -0000 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 > --- > 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