From patchwork Mon Jul 31 03:24:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Guan X-Patchwork-Id: 27271 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 2186B99CC; Mon, 31 Jul 2017 05:24:58 +0200 (CEST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 80EED99CA for ; Mon, 31 Jul 2017 05:24:57 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD6D080D; Sun, 30 Jul 2017 20:24:56 -0700 (PDT) Received: from localhost.localdomain.com (unknown [10.169.40.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D0C943F3E1; Sun, 30 Jul 2017 20:24:55 -0700 (PDT) From: Herbert Guan To: dev@dpdk.org Cc: Herbert Guan Date: Mon, 31 Jul 2017 11:24:33 +0800 Message-Id: <1501471473-3092-1-git-send-email-herbert.guan@arm.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/bonding: validate bonded port id before access its data X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fixes: 4c42498d916d ("net/bonding: allow slaves to also be bonded devices") Signed-off-by: Herbert Guan --- drivers/net/bonding/rte_eth_bond_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 824ab4f..6039500 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -514,11 +514,11 @@ { struct bond_dev_private *internals; - internals = rte_eth_devices[bonded_port_id].data->dev_private; - if (valid_bonded_port_id(bonded_port_id) != 0) return -1; + internals = rte_eth_devices[bonded_port_id].data->dev_private; + if (valid_slave_port_id(slave_port_id, internals->mode) != 0) return -1;