From patchwork Mon May 7 17:28:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anju Thomas X-Patchwork-Id: 909622 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ericsson.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="Lr+317fS"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="Z5lAGgqk"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40fcj049cRz9s27 for ; Mon, 7 May 2018 19:27:32 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id EFCC3407; Mon, 7 May 2018 09:27:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 5B60331 for ; Mon, 7 May 2018 09:27:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sesbmg22.ericsson.net (sesbmg22.ericsson.net [193.180.251.48]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 52C6BF4 for ; Mon, 7 May 2018 09:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1525685244; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=4CM1OajD9dAx/7Pd+rjq5ZHiEkJo6X0HlPQ2S2ktRXk=; b=Lr+317fSrxpk6q/2wpw+3RdWc7lX4e1aIWQLh8vUL9gQSudoqPHIzDAVwHrQ/v9r +upkHilO5Tt5gtN1XMShANkm7+Z2EuWgVUC9omlvi9GR4A58sOlPt6ywMLI0g11u 0farU2PnuX0KcPVWPpAIk+hBW8Yw53kIWgo0Zg/M0dY=; X-AuditID: c1b4fb30-4c8039c000007681-a4-5af01bfcbb93 Received: from ESESSHC004.ericsson.se (Unknown_Domain [153.88.183.30]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id CA.1B.30337.CFB10FA5; Mon, 7 May 2018 11:27:24 +0200 (CEST) Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSHC004.ericsson.se (153.88.183.30) with Microsoft SMTP Server (TLS) id 14.3.382.0; Mon, 7 May 2018 11:27:20 +0200 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSMB502.ericsson.se (153.88.183.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 7 May 2018 11:27:20 +0200 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB502.ericsson.se (153.88.183.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Mon, 7 May 2018 11:27:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FqnCBDlhdv0JRRW0CUdTOqhawv4UpI1kLU42p8FShPU=; b=Z5lAGgqktspQybKgHOq5xK3B2iwq18gn2HZ5f8jEWzhZPVSyZ4wq06BPFvCjwtV3sDzGK9rrh2CsTfYQgi2o59SeUAiAOW1Bb2eihR46fJCBYum8CJ3lLzw/ySiyIUGOqxjuty39ch0z4B+sRD5Rpu2GiWjPwGtKLRW41Z2ISKk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anju.thomas@ericsson.com; Received: from localhost.localdomain (125.16.128.122) by AM4PR07MB3505.eurprd07.prod.outlook.com (2603:10a6:205:b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.755.10; Mon, 7 May 2018 09:27:18 +0000 From: Anju Thomas To: Date: Mon, 7 May 2018 22:58:06 +0530 Message-ID: <1525714086-2264-1-git-send-email-anju.thomas@ericsson.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [125.16.128.122] X-ClientProxiedBy: BM1PR0101CA0023.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:18::33) To AM4PR07MB3505.eurprd07.prod.outlook.com (2603:10a6:205:b::30) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM4PR07MB3505; X-Microsoft-Exchange-Diagnostics: 1; AM4PR07MB3505; 3:1nt3eRRwKXRkzh5LOxo7a68kVCmrymZJHV0xvVyoTXBJ1CpJHUN1GRYN1E0/pXHQYWOM3pmPK2D7vlXTs7H7BrxlFh5aoV0FmvBNAoCDWPqH1PbVXpk4HOxECK4YTFyJT+U/rZqXRdvw+6StJf7QR+sGv6Tfyja4Qnaf+WCDqQ8gfZu+B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bB7EEtaZaN7LSWvgVEvmzLrBWv8/UO7t7Iun9a1gNMEtl73tDI5Y980FonCr/8lVqxN7y8UZhGwbCT1lp/iM/n1CPc+URL5vesyc1kIIeSyl4zLY3x9JXxzCz8CITQCvvGh1+LYtts9xzjjJ98BDz6VHwhzHKH8Ze8WHvEuEAk1w2txlgFu; 4:ffBOs5bTAFksM0RTrgKDfk4w8FpLfETk9pIb1kLh8sgReoZXzribzvOi05d+s6atJhqAledG5daHPoehHkLEz+G7T0eVDEXwJ8T/DjrUu9GXyjoM5fLcDsvOQ87bKtJJn1rebEk9OlFsh5HIX+vNWYnGUXcS33oALS6WTFJk9MdsFyEHiJhi4UYhQRxDXQmQAp8m45LL8hxvcgLZ/cIy9ev5llEsoh0hFVlNBpbPpFiXwSLWCnwQqjNAo69W8rM57DyGEK233VhNSZsaF+eDO5lz3AelfNCoPu+RbfOI6mS3EHkbmeGPs2z0UbHdYfaG X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(37575265505322); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:AM4PR07MB3505; BCL:0; PCL:0; RULEID:; SRVR:AM4PR07MB3505; X-Forefront-PRVS: 066517B35B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(366004)(376002)(39860400002)(396003)(39380400002)(189003)(199004)(6512007)(316002)(486006)(48376002)(6666003)(5660300001)(105586002)(106356001)(8936002)(2616005)(50466002)(44832011)(956004)(476003)(478600001)(16586007)(6916009)(305945005)(7736002)(68736007)(4326008)(36756003)(25786009)(186003)(55236004)(26005)(6486002)(66066001)(15650500001)(575784001)(53936002)(6506007)(86362001)(81166006)(8676002)(97736004)(2906002)(47776003)(81156014)(16526019)(52116002)(51416003)(2361001)(2351001)(50226002)(386003)(107886003)(6116002)(3846002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR07MB3505; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR07MB3505; 23:YDmJebLAxzYX3KNlg8R8YxXOVJ5AdwbrlbGpMyxvi?= SpM7uGMJqDg9NEfpsJs5T1IcujeWwqSn7S1LPftAJrC0unFwese7DSAoTJPqc/xQE2UrkpvfDaGTZMw8B/7kXeK6A77fUnDyVX2J7TknSF+81LqRYRKMlfnscM4k70s6qIfxFKnh+vmwI35WxVCzBvgCvOhKFsHtlVDihOgazcB1ZuixTGnOW0c4j73BG6qSWL8/ZTBpjhpul2tYe9RBxIRvmvY3quX2EnfTAESeHK6fxOFYBf0l6ymCKRd9AokmzWxdaH41WlSgiyMjhu+f2YE4nYC4IPaswJHQWPBfov+l+7E3zJ78tFp3kB4jlrk/XYk++Ls2Bd10BIdKDCh1V8q2fLAM4My8x6BAlWagD/+pP5zF2KDdlRMlfkl6Wk7uCeIrTuKvMrlO71cWLTv6wS5IbIQYjApBU//zCCmAeRD7NzkVBVIXxtvf4Oo6gMEiTfMQbOs6RljMWSk4/R/t86i2Kj52xiUbNBeqAoYkXwxapXyZh/YdrPBmBhOWEKoQPQ+lpXe6tr9Jo27wMr5mL0oVFjh6p1I/qoxFtSO/EtAhIlcndb8IRnD0FBhlr2ShIJGkbyaN8VN1S1Wdm4VhwG+3g3tSKiD8ESo/Ed3O4KN9OLqNR/L8epatBy3peL7sMQkP4512gUIhXKHeh/m9piWlvgOSVcEXPHrgJbXbU9efIWuPOLcJuUoGvbgsm7WwoIj5u85xVj7hzakU3dJ7jl8K4fetSS3hA44777aRpZIJ5Z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g/QdqhvQIRAhx6bG3Zztse3QX++bMlu60b6ue8KzuJYwctVvmm/1wCoReC+KfRpYFSFEPKrwGcExCV048DcpMjrNcQfFrXu6yKkp1O96vVds64BmPPxmLPbg7KW5Ijay377l4qdDLsLXXc9rYQTRfw==; 5:PdGUgMNZ5PZyLtODOqkFpO1EBGwe+tSY1MvCMbwWb1nxT/LDddewGhYl1qPPdEL8iXwpV4LFGu5n20mYGjIBEICdKyWRnjxvU/fqbwi4zbDd3VEgczHdo9krZkGvJZLDEorZ4PSPJhYs+9sX8I1I8OZqTXUA8gxvMnCyh8dgOas=; 24:djxoaACByFaN4Eh8uFbNv0hGcPnyXRJG2MLg+Z0LCnJ8ESQdEMwabQ8mbZjHqcMO9VhiaOvXh6chaM6Q92GyDovDUcXTJK34BLWpAtRTBhg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR07MB3505; 7:mWq83AkbLLT2W9lEa0rgaEOFfe86Oe/MlnBZVAX05qumdzD3s+1owQBFNPrhK/jN8pRo/DTRBXC55vasLILDbfRL5Hwtctk9gaJAZps4sVBzfTxgbpIT4taKCAfaMqWgz1T0VO3r0+GwK5R/V+S2oUrLgp2wc3BxQuIgBbWbTYNVQVJ8STV6UhlCs6TCvbQG3sZvgwgj1hycvo+w2TCke8uCUBFPhjjRddSmdwLOujpCcQF5dTaqt8Bzc1DkxuH1 X-MS-Office365-Filtering-Correlation-Id: 7cb027ca-1309-448f-52a0-08d5b3fcbb08 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2018 09:27:18.7714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7cb027ca-1309-448f-52a0-08d5b3fcbb08 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR07MB3505 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02RbUhTYRTHee7LvBuubsvo5Bs0KkXUlhWIRFgW9mnYl4iF1tKbinPqvSbZ hxhDKydbihJNM8URlKBUrmbhS5uunLIF80vZBxPMlGGtfFsmmpdnhd9+5/z/5/A/z8OQimkq minWV3K8XqtTSmSU9aIjPmU9JqhRrW3uT3eP95OZ6Nzsp02UgzSyEwWcrriK4w+fvCIrajKr yy2JN4Z9g5QBLcWakJQB9hgsmO/QJiRjFOwIgtXJEQkuehH4Xq+EleWtYiqAxBEFayPgrilZ ZIr9RYC9IU9kxF4Cm20D4YHbBLhCs6QJMYyETYYGu070RLH7YMNml4hMsknQ1j5Ai7ybPQ/L 9mc03nkA2l95SZHlbDbMBBwIR40Hz7smGvd3gcc6Q+E9AM65ORJ7lPCmdyrMDxCsTIMYQcEe BPdouB0Hbu9DSowJ7BCCvnv9NBYMEfA5WIE5CTprPTQ2hSTg/NJKYKEEBs0/w4EyILC2+j/c mNlH4IGXJLR2LEdgIRbME0MUZj8Nz+9H4VfkwP6xRtKAUlq2HdSy7aAORHShPQInXC0tTEtL 5fjifEEo06fqucoXaOvjnfY/qj40/+2UC7EMUkbKrcM/NApaWyVUl7oQMKQySr7TvdWSF2ir b3J82WX+uo4TXCiGoZR75enqXo2CLdRWciUcV87x/1SCkUYbkGXx7Xz9hKXtVkKqcc2zQyq9 MEVlPTWqz3YHfB/4haV6VW620dHdEW06fiiHrusJrfLN6/5O66O6jPlE3dfGAbVz8bffG9Es zfePPz5te69RuSoyzwQjvx+11LZONE47guNji4a8AeOTwpS4hNyY0VDWtRr5ZGBIX+ed1Xcp KaFIeySJ5AXtX1rGA4f0AgAA X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_06_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Anju Thomas Subject: [ovs-dev] [PATCH v1] Fix crash when processing malformed Bundle Add message in OVS X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When an OpenFlow Bundle Add message is received, a bundle entry is created and the OpenFlow message embedded in the bundle add message is processed. If any error is encountered while processing the embedded message, the bundle entry is freed. The bundle entry free function assumes that the entry has been populated with a properly formatted OpenFlow message and performs some message specific cleanup actions . This assumption does not hold true in the error case and OVS crashes when performing the cleanup. The fix is in case of errors, simply free the bundle entry without attempting to perform any embedded message cleanup Signed-off-by: Anju Thomas Signed-off-by: Anju Thomas Signed-off-by: Ben Pfaff Signed-off-by: Anju Thomas Signed-off-by: Ben Pfaff --- ofproto/bundles.c | 2 +- ofproto/bundles.h | 18 ++++++++++-------- ofproto/ofproto.c | 19 ++++++++++++++++--- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ofproto/bundles.c b/ofproto/bundles.c index 405ec8c..628ba0a 100644 --- a/ofproto/bundles.c +++ b/ofproto/bundles.c @@ -63,7 +63,7 @@ ofp_bundle_remove__(struct ofconn *ofconn, struct ofp_bundle *bundle) struct ofp_bundle_entry *msg; LIST_FOR_EACH_POP (msg, node, &bundle->msg_list) { - ofp_bundle_entry_free(msg); + ofp_bundle_entry_free(msg, true); } ofconn_remove_bundle(ofconn, bundle); diff --git a/ofproto/bundles.h b/ofproto/bundles.h index 806e853..7fc731c 100644 --- a/ofproto/bundles.h +++ b/ofproto/bundles.h @@ -60,7 +60,7 @@ struct ofp_bundle { static inline struct ofp_bundle_entry *ofp_bundle_entry_alloc( enum ofptype type, const struct ofp_header *oh); -static inline void ofp_bundle_entry_free(struct ofp_bundle_entry *); +static inline void ofp_bundle_entry_free(struct ofp_bundle_entry *, bool); enum ofperr ofp_bundle_open(struct ofconn *, uint32_t id, uint16_t flags, const struct ofp_header *); @@ -84,15 +84,17 @@ ofp_bundle_entry_alloc(enum ofptype type, const struct ofp_header *oh) } static inline void -ofp_bundle_entry_free(struct ofp_bundle_entry *entry) +ofp_bundle_entry_free(struct ofp_bundle_entry *entry, bool cleanup) { if (entry) { - if (entry->type == OFPTYPE_FLOW_MOD) { - ofproto_flow_mod_uninit(&entry->ofm); - } else if (entry->type == OFPTYPE_GROUP_MOD) { - ofputil_uninit_group_mod(&entry->ogm.gm); - } else if (entry->type == OFPTYPE_PACKET_OUT) { - ofproto_packet_out_uninit(&entry->opo); + if (cleanup) { + if (entry->type == OFPTYPE_FLOW_MOD) { + ofproto_flow_mod_uninit(&entry->ofm); + } else if (entry->type == OFPTYPE_GROUP_MOD) { + ofputil_uninit_group_mod(&entry->ogm.gm); + } else if (entry->type == OFPTYPE_PACKET_OUT) { + ofproto_packet_out_uninit(&entry->opo); + } } free(entry->msg); free(entry); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 36f4c0b..bfbc043 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -7901,6 +7901,7 @@ handle_bundle_add(struct ofconn *ofconn, const struct ofp_header *oh) struct ofputil_bundle_add_msg badd; struct ofp_bundle_entry *bmsg; enum ofptype type; + bool cleanup=true; error = reject_slave_controller(ofconn); if (error) { @@ -7929,7 +7930,13 @@ handle_bundle_add(struct ofconn *ofconn, const struct ofp_header *oh) &ofproto->vl_mff_map, &ofpacts, u16_to_ofp(ofproto->max_ports), ofproto->n_tables); - if (!error) { + if (error) { + VLOG_WARN("Unable to parse OFPTYPE_FLOW_MOD message in " + "OFPTYPE_BUNDLE_ADD_MESSAGE(bundle idx = %x)" + "successfully", + badd.bundle_id); + cleanup=false; + } else { error = ofproto_flow_mod_init(ofproto, &bmsg->ofm, &fm, NULL); minimatch_destroy(&fm.match); } @@ -7944,7 +7951,13 @@ handle_bundle_add(struct ofconn *ofconn, const struct ofp_header *oh) error = ofputil_decode_packet_out(&po, badd.msg, ofproto_get_tun_tab(ofproto), &ofpacts); - if (!error) { + if (error) { + VLOG_WARN("Unable to parse OFPTYPE_PACKET_OUT message in " + "OFPTYPE_BUNDLE_ADD_MESSAGE(bundle idx = %x)" + "successfully", + badd.bundle_id); + cleanup=false; + } else { po.ofpacts = ofpbuf_steal_data(&ofpacts); /* Move to heap. */ error = ofproto_packet_out_init(ofproto, ofconn, &bmsg->opo, &po); } @@ -7960,7 +7973,7 @@ handle_bundle_add(struct ofconn *ofconn, const struct ofp_header *oh) } if (error) { - ofp_bundle_entry_free(bmsg); + ofp_bundle_entry_free(bmsg, cleanup); } return error;