hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/sched/ematch.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * net/sched/ematch.c Extended Match API
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation; either version
7
- * 2 of the License, or (at your option) any later version.
84 *
95 * Authors: Thomas Graf <tgraf@suug.ch>
106 *
....@@ -259,6 +255,8 @@
259255 * the value carried.
260256 */
261257 if (em_hdr->flags & TCF_EM_SIMPLE) {
258
+ if (em->ops->datalen > 0)
259
+ goto errout;
262260 if (data_len < sizeof(u32))
263261 goto errout;
264262 em->data = *(u32 *) data;
....@@ -317,7 +315,8 @@
317315 if (!nla)
318316 return 0;
319317
320
- err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy, NULL);
318
+ err = nla_parse_nested_deprecated(tb, TCA_EMATCH_TREE_MAX, nla,
319
+ em_policy, NULL);
321320 if (err < 0)
322321 goto errout;
323322
....@@ -392,7 +391,6 @@
392391 /**
393392 * tcf_em_tree_destroy - destroy an ematch tree
394393 *
395
- * @tp: classifier kind handle
396394 * @tree: ematch tree to be deleted
397395 *
398396 * This functions destroys an ematch tree previously created by
....@@ -428,7 +426,7 @@
428426 * tcf_em_tree_dump - dump ematch tree into a rtnl message
429427 *
430428 * @skb: skb holding the rtnl message
431
- * @t: ematch tree to be dumped
429
+ * @tree: ematch tree to be dumped
432430 * @tlv: TLV type to be used to encapsulate the tree
433431 *
434432 * This function dumps a ematch tree into a rtnl message. It is valid to
....@@ -443,14 +441,14 @@
443441 struct nlattr *top_start;
444442 struct nlattr *list_start;
445443
446
- top_start = nla_nest_start(skb, tlv);
444
+ top_start = nla_nest_start_noflag(skb, tlv);
447445 if (top_start == NULL)
448446 goto nla_put_failure;
449447
450448 if (nla_put(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr))
451449 goto nla_put_failure;
452450
453
- list_start = nla_nest_start(skb, TCA_EMATCH_TREE_LIST);
451
+ list_start = nla_nest_start_noflag(skb, TCA_EMATCH_TREE_LIST);
454452 if (list_start == NULL)
455453 goto nla_put_failure;
456454