Blame SOURCES/0005-ioctl-prevent-argc-underflow-in-do_perqueue.patch

4f6fcd
From 04315b072d623ba9200612a4c5f5330f1eb28a27 Mon Sep 17 00:00:00 2001
4f6fcd
From: Michal Kubecek <mkubecek@suse.cz>
4f6fcd
Date: Sun, 23 Aug 2020 21:40:24 +0200
4f6fcd
Subject: [PATCH 05/17] ioctl: prevent argc underflow in do_perqueue()
4f6fcd
4f6fcd
When first command line argument after "-Q" is "queue_mask", we parse
4f6fcd
the queue mask and following subcommand without checking if these
4f6fcd
arguments do actually exist. Add check if we have at least two arguments
4f6fcd
left after "queue_mask" in the corresponding branch.
4f6fcd
4f6fcd
Fixes: 9ecd54248b1a ("ethtool: introduce new ioctl for per-queue settings")
4f6fcd
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
4f6fcd
(cherry picked from commit 39c354e591b66cc29edaab89f90ed03a513ad88f)
4f6fcd
---
4f6fcd
 ethtool.c | 2 ++
4f6fcd
 1 file changed, 2 insertions(+)
4f6fcd
4f6fcd
diff --git a/ethtool.c b/ethtool.c
4f6fcd
index 4fa7a2c1716f..6c12452be7b4 100644
4f6fcd
--- a/ethtool.c
4f6fcd
+++ b/ethtool.c
4f6fcd
@@ -5880,6 +5880,8 @@ static int do_perqueue(struct cmd_context *ctx)
4f6fcd
 			"The sub commands will be applied to all %d queues\n",
4f6fcd
 			n_queues);
4f6fcd
 	} else {
4f6fcd
+		if (ctx->argc <= 2)
4f6fcd
+			exit_bad_args();
4f6fcd
 		ctx->argc--;
4f6fcd
 		ctx->argp++;
4f6fcd
 		if (parse_hex_u32_bitmap(*ctx->argp, MAX_NUM_QUEUE,
4f6fcd
-- 
4f6fcd
2.26.2
4f6fcd