From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 436D6F90 for ; Mon, 30 Apr 2018 16:54:08 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id a8so13668451wmg.5 for ; Mon, 30 Apr 2018 07:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sbv2+1KlYMTC9haICi97R0UigGAJ6AnXPYFw/xFjc48=; b=Vf3cD0CQIgHWNjriSC3ms1m3dnXMOzahjsSNtKDfFy8LoFsGRzGAz/LfcoB8bfUIdE b69m5nPkRtVM3MC9/mop++/HI1pM+zbZH+huAdbHIv5ydZXhxA8G2PAjZu3Jwqg/lCIJ KsP0SzBm56e/jg7MkKpurkQXS9K5fkYpTrtX/ujcqFzD7bs6JzE5nW+CI/FCJewsXAYk FuFE8hajmVfqQ0MDDL62+TyhEeyjirJGvyiZpC2u2VkAoeMiFlFtBgFyXhAopUoxbE4V S+bt4qUOhw7tDerYtwhMdGDwq/lEbQHllO0JgX3IfXs1S6Ssw9DQkeJD0J40cDOvSebh 2gtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sbv2+1KlYMTC9haICi97R0UigGAJ6AnXPYFw/xFjc48=; b=sVK+KsFsvil7zW0PmQSWeD/OuzcmiXwSEnepe5FYnEPLtaxhqZ7VJMDwR7LDCJjjk2 qjfydCWLjEMGarwHjGQsh20l/Lh73JyGgK7Za02/YA2gwX0ttaX6FAfgtj3mnnboI89j g6CZdtsWYs4k37lLTnsldykZQcLgwXh8G4lvWJC7JRn696SLBaZaZezDSIvC4WZ+4lz+ zdvLBXwvHEy6bwapGx80BVPR1+neejbwzJ2NHxlZlGFm3RLgh9G0PHL3KRO1BsO7SBuw LiaTZFSktV0eR877VoKF6gkcpNryplRqCLyjAFYyrSob79wcszsXzchboHqi5BBwBUrV NKbA== X-Gm-Message-State: ALQs6tDUnKMN120l7rKgQlKfUqP1BzhJd0l6cH3/xoLrcsfHhWgJjAFX iEi1Gy/3GJuzg1Lsc32Py1o= X-Google-Smtp-Source: AB8JxZplB7Ru2QlQkwh0v6Kf8wXxS3qErn5tNZxaNkyohNLnMO3IDTnIZT426+sqQ3DKQ0jPQirWAQ== X-Received: by 10.28.147.83 with SMTP id v80mr7582833wmd.91.1525100047964; Mon, 30 Apr 2018 07:54:07 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id y42-v6sm10078166wry.21.2018.04.30.07.54.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 07:54:07 -0700 (PDT) From: luca.boccassi@gmail.com To: Gaetan Rivet Cc: dpdk stable Date: Mon, 30 Apr 2018 15:53:21 +0100 Message-Id: <20180430145402.23057-2-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180430145402.23057-1-luca.boccassi@gmail.com> References: <20180430144223.18657-85-luca.boccassi@gmail.com> <20180430145402.23057-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'bus/vdev: fix find device implementation' has been queued to stable release 18.02.2 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: Mon, 30 Apr 2018 14:54:08 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/02/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From c2afaf6b85b6d55dee13c3742baf2052d7994a9d Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Fri, 27 Apr 2018 16:13:06 +0200 Subject: [PATCH] bus/vdev: fix find device implementation [ upstream commit 3701b792a8a3bce519adc979d5cc8d127231fd48 ] If start is set and a device before it matches the data, this device is returned. This induces potentially infinite loops. Fixes: c7fe1eea8a74 ("bus: simplify finding starting point") Signed-off-by: Gaetan Rivet --- drivers/bus/vdev/rte_bus_vdev.h | 3 +++ drivers/bus/vdev/vdev.c | 16 ++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h index f9d8a2383..4da9967c6 100644 --- a/drivers/bus/vdev/rte_bus_vdev.h +++ b/drivers/bus/vdev/rte_bus_vdev.h @@ -53,6 +53,9 @@ struct rte_vdev_device { #define RTE_DEV_TO_VDEV(ptr) \ container_of(ptr, struct rte_vdev_device, device) +#define RTE_DEV_TO_VDEV_CONST(ptr) \ + container_of(ptr, const struct rte_vdev_device, device) + static inline const char * rte_vdev_device_name(const struct rte_vdev_device *dev) { diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 7eae319cb..914073d12 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -386,15 +386,19 @@ static struct rte_device * vdev_find_device(const struct rte_device *start, rte_dev_cmp_t cmp, const void *data) { + const struct rte_vdev_device *vstart; struct rte_vdev_device *dev; - TAILQ_FOREACH(dev, &vdev_device_list, next) { - if (start && &dev->device == start) { - start = NULL; - continue; - } + if (start != NULL) { + vstart = RTE_DEV_TO_VDEV_CONST(start); + dev = TAILQ_NEXT(vstart, next); + } else { + dev = TAILQ_FIRST(&vdev_device_list); + } + while (dev != NULL) { if (cmp(&dev->device, data) == 0) - return &dev->device; + break; + dev = TAILQ_NEXT(dev, next); } return NULL; } -- 2.14.2