From patchwork Mon Jan 11 05:31:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 565640 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ECECB1402BF for ; Mon, 11 Jan 2016 16:41:18 +1100 (AEDT) Received: from localhost ([::1]:51687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIVED-0000Wl-0v for incoming@patchwork.ozlabs.org; Mon, 11 Jan 2016 00:41:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIV77-0003HP-Oi for qemu-devel@nongnu.org; Mon, 11 Jan 2016 00:33:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIV77-0008TZ-17 for qemu-devel@nongnu.org; Mon, 11 Jan 2016 00:33:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIV76-0008TQ-RD for qemu-devel@nongnu.org; Mon, 11 Jan 2016 00:33:56 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 7ABE63B719; Mon, 11 Jan 2016 05:33:56 +0000 (UTC) Received: from jason-ThinkPad-T430s.nay.redhat.com (dhcp-15-133.nay.redhat.com [10.66.15.133]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0B5VfLo018161; Mon, 11 Jan 2016 00:33:52 -0500 From: Jason Wang To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Mon, 11 Jan 2016 13:31:14 +0800 Message-Id: <1452490275-18217-24-git-send-email-jasowang@redhat.com> In-Reply-To: <1452490275-18217-1-git-send-email-jasowang@redhat.com> References: <1452490275-18217-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jason Wang , Alexis Dambricourt Subject: [Qemu-devel] [PULL 23/24] l2tpv3: fix cookie decoding X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Alexis Dambricourt 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 Signed-off-by: Jason Wang --- 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) {