浏览代码

net/sched: cls_flower: Properly handle classifier flags dumping

Dump the classifier flags only if non zero and make sure to check
the return status of the handler that puts them into the netlink msg.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Or Gerlitz 8 年之前
父节点
当前提交
749e6720d2
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      net/sched/cls_flower.c

+ 2 - 1
net/sched/cls_flower.c

@@ -1229,7 +1229,8 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
 	if (fl_dump_key_flags(skb, key->control.flags, mask->control.flags))
 	if (fl_dump_key_flags(skb, key->control.flags, mask->control.flags))
 		goto nla_put_failure;
 		goto nla_put_failure;
 
 
-	nla_put_u32(skb, TCA_FLOWER_FLAGS, f->flags);
+	if (f->flags && nla_put_u32(skb, TCA_FLOWER_FLAGS, f->flags))
+		goto nla_put_failure;
 
 
 	if (tcf_exts_dump(skb, &f->exts))
 	if (tcf_exts_dump(skb, &f->exts))
 		goto nla_put_failure;
 		goto nla_put_failure;