cls_flower: Fix incorrect idr release when failing to modify rule

[ Upstream commit 8258d2da9f ]

When we fail to modify a rule, we incorrectly release the idr handle
of the unmodified old rule.

Fix that by checking if we need to release it.

Fixes: fe2502e49b ("net_sched: remove cls_flower idr on failure")
Reported-by: Vlad Buslov <vladbu@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Paul Blakey 2018-05-30 11:29:15 +03:00 коммит произвёл Greg Kroah-Hartman
Родитель c931c9aee2
Коммит dd4be396b8
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -1007,7 +1007,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
return 0;
errout_idr:
if (fnew->handle)
if (!fold)
idr_remove_ext(&head->handle_idr, fnew->handle);
errout:
tcf_exts_destroy(&fnew->exts);