diff mbox series

[v2,2/2] fix: cls: unwind cls queues on failure

Message ID 1516348819-27675-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v2,1/2] fix: cls: invalid CoS index | expand

Commit Message

Github ODP bot Jan. 19, 2018, 8 a.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>


Fixes: https://bugs.linaro.org/show_bug.cgi?id=3576

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>

---
/** Email created from pull request 405 (bala-manoharan:bug3576)
 ** https://github.com/Linaro/odp/pull/405
 ** Patch: https://github.com/Linaro/odp/pull/405.patch
 ** Base sha: 77ff03881d844a9d6a4bc773086bd8aaecace541
 ** Merge commit sha: 0d984e3e700ae418eafe1fe25444d1a5508b56c0
 **/
 platform/linux-generic/odp_classification.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c
index 9b867576a..ee0427754 100644
--- a/platform/linux-generic/odp_classification.c
+++ b/platform/linux-generic/odp_classification.c
@@ -212,6 +212,12 @@  static void _odp_cls_update_hash_proto(cos_t *cos,
 		cos->s.hash_proto.udp = 1;
 }
 
+static inline void _cls_queue_unwind(uint32_t tbl_index, uint32_t j)
+{
+	while (j > 0)
+		odp_queue_destroy(queue_grp_tbl->s.queue[tbl_index + --j]);
+}
+
 odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param)
 {
 	int i, j;
@@ -255,6 +261,8 @@  odp_cos_t odp_cls_cos_create(const char *name, odp_cls_cos_param_t *param)
 					queue = odp_queue_create(NULL, &cos->s.
 								 queue_param);
 					if (queue == ODP_QUEUE_INVALID) {
+						/* unwind the queues */
+						_cls_queue_unwind(tbl_index, j);
 						UNLOCK(&cos->s.lock);
 						return ODP_COS_INVALID;
 					}