]> git.proxmox.com Git - mirror_iproute2.git/commit
tc: mqprio: reject queues count/offset pair count higher than num_tc
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Wed, 13 May 2020 19:47:17 +0000 (21:47 +0200)
committerDavid Ahern <dsahern@gmail.com>
Mon, 18 May 2020 14:57:15 +0000 (14:57 +0000)
commit42796dcd36772f2a0116bf8a1e94fe43733c0716
tree6012f02a76de51c423dfbbef61bf1323593df2d2
parent7bd9188581aa8abd644d45a990529a92efe50255
tc: mqprio: reject queues count/offset pair count higher than num_tc

Provide a sanity check that will make sure whether queues count/offset
pair count will not exceed the actual number of TCs being created.

Example command that is invalid because there are 4 count/offset pairs
whereas num_tc is only 2.

 # tc qdisc add dev enp96s0f0 root mqprio num_tc 2 map 0 0 0 0 1 1 1 1
queues 4@0 4@4 4@8 4@12 hw 1 mode channel

Store the parsed count/offset pair count onto a dedicated variable that
will be compared against opt.num_tc after all of the command line
arguments were parsed. Bail out if this count is higher than opt.num_tc
and let user know about it.

Drivers were swallowing such commands as they were iterating over
count/offset pairs where num_tc was used as a delimiter, so this is not
a big deal, but better catch such misconfiguration at the command line
argument parsing level.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
tc/q_mqprio.c