From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 4E0B4F72 for ; Wed, 2 Nov 2016 11:21:16 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 02 Nov 2016 03:21:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,583,1473145200"; d="scan'208";a="26465744" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by fmsmga006.fm.intel.com with ESMTP; 02 Nov 2016 03:21:14 -0700 From: Yuanhan Liu To: "E. Scott Daniels" Date: Wed, 2 Nov 2016 18:21:23 +0800 Message-Id: <1478082097-16957-27-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1478082097-16957-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1478082097-16957-1-git-send-email-yuanhan.liu@linux.intel.com> Cc: Wenzhuo Lu , dpdk stable Subject: [dpdk-stable] patch 'ethdev: prevent duplicate event callback' has been queued to stable release 16.07.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2016 10:21:16 -0000 Hi, FYI, your patch has been queued to stable release 16.07.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 11/06/16. So please shout if anyone has objections. Thanks. --yliu --- >>From 1ffa501cf744a6549c90c2a99aa20d9706f16263 Mon Sep 17 00:00:00 2001 From: "E. Scott Daniels" Date: Thu, 20 Oct 2016 09:34:41 -0400 Subject: [PATCH] ethdev: prevent duplicate event callback [ upstream commit dbffbf80e99aad7c7a5ffaf78e750ae69963f9e0 ] This change prevents the attempt to add a structure which is already on the callback list. If a struct with matching parameters is found on the list, then no action is taken. Fixes: ac2f69c ("ethdev: fix crash if malloc of user callback fails") Signed-off-by: E. Scott Daniels Acked-by: Wenzhuo Lu --- lib/librte_ether/rte_ethdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f62a9ec..cc77e90 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -2629,14 +2629,15 @@ rte_eth_dev_callback_register(uint8_t port_id, } /* create a new callback. */ - if (user_cb == NULL) + if (user_cb == NULL) { user_cb = rte_zmalloc("INTR_USER_CALLBACK", sizeof(struct rte_eth_dev_callback), 0); - if (user_cb != NULL) { - user_cb->cb_fn = cb_fn; - user_cb->cb_arg = cb_arg; - user_cb->event = event; - TAILQ_INSERT_TAIL(&(dev->link_intr_cbs), user_cb, next); + if (user_cb != NULL) { + user_cb->cb_fn = cb_fn; + user_cb->cb_arg = cb_arg; + user_cb->event = event; + TAILQ_INSERT_TAIL(&(dev->link_intr_cbs), user_cb, next); + } } rte_spinlock_unlock(&rte_eth_dev_cb_lock); -- 1.9.0