lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230705105155.51490-1-vladimir.oltean@nxp.com>
Date: Wed,  5 Jul 2023 13:51:55 +0300
From: Vladimir Oltean <vladimir.oltean@....com>
To: netdev@...r.kernel.org
Cc: David Ahern <dsahern@...nel.org>,
	Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2] tc/taprio: fix parsing of "fp" option when it doesn't appear last

When installing a Qdisc this way:

tc qdisc replace dev $ifname handle 8001: parent root stab overhead 24 taprio \
	num_tc 8 \
	map 0 1 2 3 4 5 6 7 \
	queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
	base-time 0 \
	sched-entry S 01 1216 \
	sched-entry S fe 12368 \
	fp P E E E E E E E \
	flags 0x2

the parser will error out when it tries to parse the "fp" array and it
finds "flags" as one of the elements, expecting it to be one of "P" or
"E".

The way this is handled in the parsing of other array arguments of
variable size (max-sdu, map, queues etc) is to not fail, call PREV_ARG()
and attempt re-parsing the argument as something else. Do that for "fp"
as well.

Apparently mqprio handles this case correctly, so I must have forgotten
to apply the same treatment for taprio as well, during development.

Fixes: 5fbca3b469ec ("tc/taprio: add support for preemptible traffic classes")
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
 tc/q_taprio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tc/q_taprio.c b/tc/q_taprio.c
index 65d0a30bd67f..913197f68caa 100644
--- a/tc/q_taprio.c
+++ b/tc/q_taprio.c
@@ -250,10 +250,8 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
 				} else if (strcmp(*argv, "P") == 0) {
 					fp[idx] = TC_FP_PREEMPTIBLE;
 				} else {
-					fprintf(stderr,
-						"Illegal \"fp\" value \"%s\", expected \"E\" or \"P\"\n",
-						*argv);
-					return -1;
+					PREV_ARG();
+					break;
 				}
 				num_fp_entries++;
 				idx++;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ