[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <48ef048e78abee08eb6403985786659840d419e4.1598210544.git.mkubecek@suse.cz>
Date: Sun, 23 Aug 2020 21:40:24 +0200 (CEST)
From: Michal Kubecek <mkubecek@...e.cz>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>,
Nicholas Nunley <nicholas.d.nunley@...el.com>
Subject: [PATCH ethtool v2 3/9] 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@...e.cz>
---
ethtool.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ethtool.c b/ethtool.c
index 4fa7a2c1716f..6c12452be7b4 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,
--
2.28.0
Powered by blists - more mailing lists