From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E9096A00E6 for ; Fri, 19 Apr 2019 12:28:02 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BBA4A1BBD0; Fri, 19 Apr 2019 12:28:02 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B72FA1BB91; Fri, 19 Apr 2019 12:28:00 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2019 03:27:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,369,1549958400"; d="scan'208";a="132692711" Received: from silpixa00399499.ir.intel.com (HELO silpixa00399499.ger.corp.intel.com) ([10.237.222.133]) by orsmga007.jf.intel.com with ESMTP; 19 Apr 2019 03:27:57 -0700 From: Herakliusz Lipiec To: Keith Wiles Cc: dev@dpdk.org, ferruh.yigit@intel.com, Herakliusz Lipiec , rasland@mellanox.com, stable@dpdk.org Date: Fri, 19 Apr 2019 11:28:52 +0100 Message-Id: <20190419102852.45526-1-herakliusz.lipiec@intel.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190418171923.570-1-herakliusz.lipiec@intel.com> References: <20190418171923.570-1-herakliusz.lipiec@intel.com> Subject: [dpdk-dev] [PATCH v2] net/tap: ipc add check for number of messages received 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190419102852.WpY59nuRPa_6ig9j07fjfq5P4282JnsEGtbIrwUxcyc@z> A sucessfull call to rte_mp_request_sync does not guarantee that there are any messages in the buffer, and this should be checked for before accessing data in the message. Buffer can be empty if IPC is disabled or if we deciede to ignore replies. Fixes: c9aa56edec8e ("net/tap: access primary process queues from secondary") Cc: rasland@mellanox.com Cc: stable@dpdk.org Signed-off-by: Herakliusz Lipiec --- drivers/net/tap/rte_eth_tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index e9fda8cf6..7f74b5dc9 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -2101,7 +2101,7 @@ tap_mp_attach_queues(const char *port_name, struct rte_eth_dev *dev) request.len_param = sizeof(*request_param); /* Send request and receive reply */ ret = rte_mp_request_sync(&request, &replies, &timeout); - if (ret < 0) { + if (ret < 0 || replies.nb_received != 1) { TAP_LOG(ERR, "Failed to request queues from primary: %d", rte_errno); return -1; -- 2.17.2