Blob Blame History Raw
From: Jiri Pirko <jiri@mellanox.com>
Date: Wed, 8 Aug 2018 14:04:13 +0200
Subject: net: sched: fix block->refcnt decrement
Patch-mainline: v4.19-rc1
Git-commit: 63cc5bcc9fc467bbe61cc9ee52509294bdf04c4b
References: bsc#1109837

Currently the refcnt is never decremented in case the value is not 1.
Fix it by adding decrement in case the refcnt is not 1.

Reported-by: Vlad Buslov <vladbu@mellanox.com>
Fixes: f71e0ca4db18 ("net: sched: Avoid implicit chain 0 creation")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 net/sched/cls_api.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -781,6 +781,8 @@ void tcf_block_put_ext(struct tcf_block
 		block->refcnt--;
 		if (list_empty(&block->chain_list))
 			kfree(block);
+	} else {
+		block->refcnt--;
 	}
 }
 EXPORT_SYMBOL(tcf_block_put_ext);