[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHcxVNNRRCMtT0AyNk4OTcqBn6wWTk37SJw9eWChKhxGRCjUCQ@mail.gmail.com>
Date: Sat, 27 Jul 2024 22:39:46 +0900
From: 백광록 <zester926@...il.com>
To: netdev@...r.kernel.org
Cc: mkubecek@...e.cz, ahmed.zaki@...el.com, ecree@...arflare.com
Subject: [PATCH net] ethtool: fix argument check in do_srxfh function to
prevent segmentation fault
Ensure that do_srxfh function in ethtool.c checks for the presence of
additional arguments when context or xfrm parameter is provided before
performing strcmp. This prevents segmentation faults caused by missing
arguments.
Without this patch, running 'ethtool -X DEVNAME [ context | xfrm ]' without
additional arguments results in a segmentation fault due to an invalid
strcmp operation.
Fixes: f5d55b967e0c ("ethtool: add support for extra RSS contexts and
RSS steering filters")
Fixes: a6050b18ba73 ("ethtool: add support for RSS input transformation")
Signed-off-by: Gwangrok Baek <zester926@...il.com>
---
ethtool.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ethtool.c b/ethtool.c
index d85a57a..8cb722b 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -4261,6 +4261,8 @@ static int do_srxfh(struct cmd_context *ctx)
++arg_num;
} else if (!strcmp(ctx->argp[arg_num], "xfrm")) {
++arg_num;
+ if (!ctx->argp[arg_num])
+ exit_bad_args();
if (!strcmp(ctx->argp[arg_num], "symmetric-xor"))
req_input_xfrm = RXH_XFRM_SYM_XOR;
else if (!strcmp(ctx->argp[arg_num], "none"))
@@ -4270,6 +4272,8 @@ static int do_srxfh(struct cmd_context *ctx)
++arg_num;
} else if (!strcmp(ctx->argp[arg_num], "context")) {
++arg_num;
+ if (!ctx->argp[arg_num])
+ exit_bad_args();
if(!strcmp(ctx->argp[arg_num], "new"))
rss_context = ETH_RXFH_CONTEXT_ALLOC;
else
--
2.43.0
Powered by blists - more mailing lists