소스 검색

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 <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>
Paul Blakey 7 년 전
부모
커밋
8258d2da9f
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      net/sched/cls_flower.c

+ 1 - 1
net/sched/cls_flower.c

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