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 7D7D71B4A1; Tue, 8 Jan 2019 12:30:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2019 03:30:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,453,1539673200"; d="scan'208";a="115091760" Received: from dwdohert-ws.ir.intel.com ([163.33.210.60]) by fmsmga008.fm.intel.com with ESMTP; 08 Jan 2019 03:29:58 -0800 From: Declan Doherty To: dev@dpdk.org Cc: stable@dpdk.org, Chas Williams , Declan Doherty Date: Tue, 8 Jan 2019 11:17:56 +0000 Message-Id: <20190108111756.9118-1-declan.doherty@intel.com> X-Mailer: git-send-email 2.14.5 Subject: [dpdk-dev] net/bonding: fix possible null pointer reference 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: , X-List-Received-Date: Tue, 08 Jan 2019 11:30:02 -0000 In function check_for_bonded_ethdev the driver name is used without validating the pointer references in the passed ethdev object. Fixes: 740feaf349b1 ("ethdev: remove driver name from device private data") Cc: stable@dpdk.org Signed-off-by: Declan Doherty --- drivers/net/bonding/rte_eth_bond_api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 21bcd5044..e5e146540 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -19,7 +19,10 @@ int check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev) { /* Check valid pointer */ - if (eth_dev->device->driver->name == NULL) + if (eth_dev == NULL || + eth_dev->device == NULL || + eth_dev->device->driver == NULL || + eth_dev->device->driver->name == NULL) return -1; /* return 0 if driver name matches */ -- 2.14.5