aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2020-08-23 21:40:24 +0200
committerMichal Kubecek <mkubecek@suse.cz>2020-08-27 10:52:16 +0200
commit39c354e591b66cc29edaab89f90ed03a513ad88f (patch)
tree210c398aa07dc290e0cfda4820d56868f90b8024
parent923c3f51c4442a5f25afb529bd49ec2ef4f185a3 (diff)
downloadethtool-39c354e591b66cc29edaab89f90ed03a513ad88f.tar.gz
ioctl: prevent argc underflow in do_perqueue()
When first command line argument after "-Q" is "queue_mask", we parse the queue mask and following subcommand without checking if these arguments do actually exist. Add check if we have at least two arguments left after "queue_mask" in the corresponding branch. Fixes: 9ecd54248b1a ("ethtool: introduce new ioctl for per-queue settings") Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
-rw-r--r--ethtool.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ethtool.c b/ethtool.c
index 4fa7a2c..6c12452 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -5880,6 +5880,8 @@ static int do_perqueue(struct cmd_context *ctx)
"The sub commands will be applied to all %d queues\n",
n_queues);
} else {
+ if (ctx->argc <= 2)
+ exit_bad_args();
ctx->argc--;
ctx->argp++;
if (parse_hex_u32_bitmap(*ctx->argp, MAX_NUM_QUEUE,