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 1AF3C370; Tue, 13 Dec 2016 08:11:14 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 12 Dec 2016 23:11:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,340,1477983600"; d="scan'208";a="1071418199" Received: from dpdk26.sh.intel.com ([10.239.128.228]) by orsmga001.jf.intel.com with ESMTP; 12 Dec 2016 23:11:12 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu , "Chen Jing D(Mark)" , stable@dpdk.org Date: Tue, 13 Dec 2016 15:11:08 +0800 Message-Id: <1481613068-92744-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dpdk-stable] [PATCH] app/testpmd: fix invalid port ID 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: Tue, 13 Dec 2016 07:11:16 -0000 Some CLIs don't check the input port ID, it may cause segmentation fault (core dumped). Fixes: 425781ff5afe ("app/testpmd: add ixgbe VF management") Signed-off-by: Wenzhuo Lu Signed-off-by: Chen Jing D(Mark) --- CC: stable@dpdk.org --- app/test-pmd/cmdline.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 63b55dc..315a252 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -10807,6 +10807,9 @@ struct cmd_vf_vlan_anti_spoof_result { int ret = 0; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_vf_vlan_anti_spoof(res->port_id, res->vf_id, is_on); switch (ret) { @@ -10892,6 +10895,9 @@ struct cmd_vf_mac_anti_spoof_result { int ret; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_vf_mac_anti_spoof(res->port_id, res->vf_id, is_on); switch (ret) { @@ -10977,6 +10983,9 @@ struct cmd_vf_vlan_stripq_result { int ret = 0; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_vf_vlan_stripq(res->port_id, res->vf_id, is_on); switch (ret) { case 0: @@ -11060,6 +11069,9 @@ struct cmd_vf_vlan_insert_result { struct cmd_vf_vlan_insert_result *res = parsed_result; int ret; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_vf_vlan_insert(res->port_id, res->vf_id, res->vlan_id); switch (ret) { case 0: @@ -11134,6 +11146,9 @@ struct cmd_tx_loopback_result { int ret; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_tx_loopback(res->port_id, is_on); switch (ret) { case 0: @@ -11211,6 +11226,9 @@ struct cmd_all_queues_drop_en_result { int ret = 0; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_all_queues_drop_en(res->port_id, is_on); switch (ret) { case 0: @@ -11294,6 +11312,9 @@ struct cmd_vf_split_drop_en_result { int ret; int is_on = (strcmp(res->on_off, "on") == 0) ? 1 : 0; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_vf_split_drop_en(res->port_id, res->vf_id, is_on); switch (ret) { @@ -11378,6 +11399,9 @@ struct cmd_set_vf_mac_addr_result { struct cmd_set_vf_mac_addr_result *res = parsed_result; int ret; + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) + return; + ret = rte_pmd_ixgbe_set_vf_mac_addr(res->port_id, res->vf_id, &res->mac_addr); switch (ret) { -- 1.9.3