From: Paul Blakey Date: Wed, 30 May 2018 08:29:15 +0000 (+0300) Subject: cls_flower: Fix incorrect idr release when failing to modify rule X-Git-Tag: v4.19~955^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8258d2da9f9f521dce7019e018360c28d116354e;p=platform%2Fkernel%2Flinux-rpi3.git cls_flower: Fix incorrect idr release when failing to modify rule 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: fe2502e49b58 ("net_sched: remove cls_flower idr on failure") Reported-by: Vlad Buslov Reviewed-by: Roi Dayan Acked-by: Jiri Pirko Signed-off-by: Paul Blakey Signed-off-by: David S. Miller --- diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index d964e60..c79f6e7 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -977,7 +977,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, return 0; errout_idr: - if (fnew->handle) + if (!fold) idr_remove(&head->handle_idr, fnew->handle); errout: tcf_exts_destroy(&fnew->exts);