From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36725) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGeLw-0007dh-1K for qemu-devel@nongnu.org; Tue, 05 Jan 2016 22:01:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGeLs-0003Em-Gt for qemu-devel@nongnu.org; Tue, 05 Jan 2016 22:01:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGeLs-0003Ei-Bg for qemu-devel@nongnu.org; Tue, 05 Jan 2016 22:01:32 -0500 References: <1451949967-30272-1-git-send-email-alexis.dambricourt@gmail.com> From: Jason Wang Message-ID: <568C8383.3010903@redhat.com> Date: Wed, 6 Jan 2016 11:01:23 +0800 MIME-Version: 1.0 In-Reply-To: <1451949967-30272-1-git-send-email-alexis.dambricourt@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] l2tpv3: fix cookie decoding List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexis Dambricourt , qemu-devel@nongnu.org On 01/05/2016 07:26 AM, Alexis Dambricourt wrote: > If a 32 bits l2tpv3 frame cookie MSB if set to 1, the cast to uint64_t > cookie will spread 1 to the four most significant bytes. > Then the condition (cookie != s->rx_cookie) becomes false. > > Signed-off-by: Alexis Dambricourt > --- > net/l2tpv3.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/l2tpv3.c b/net/l2tpv3.c > index 8e68e54..21d6119 100644 > --- a/net/l2tpv3.c > +++ b/net/l2tpv3.c > @@ -325,7 +325,7 @@ static int l2tpv3_verify_header(NetL2TPV3State *s, uint8_t *buf) > if (s->cookie_is_64) { > cookie = ldq_be_p(buf + s->cookie_offset); > } else { > - cookie = ldl_be_p(buf + s->cookie_offset); > + cookie = ldl_be_p(buf + s->cookie_offset) & 0xffffffffULL; > } > if (cookie != s->rx_cookie) { > if (!s->header_mismatch) { Applied to my -net. Thanks