* [PATCH net] ethtool: fix argument check in do_srxfh function to prevent segmentation fault
@ 2024-07-27 13:39 백광록
2024-07-30 2:04 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: 백광록 @ 2024-07-27 13:39 UTC (permalink / raw)
To: netdev; +Cc: mkubecek, ahmed.zaki, ecree
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@gmail.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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] ethtool: fix argument check in do_srxfh function to prevent segmentation fault
2024-07-27 13:39 [PATCH net] ethtool: fix argument check in do_srxfh function to prevent segmentation fault 백광록
@ 2024-07-30 2:04 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2024-07-30 2:04 UTC (permalink / raw)
To: 백광록; +Cc: netdev, mkubecek, ahmed.zaki, ecree
On Sat, 27 Jul 2024 22:39:46 +0900 백광록 wrote:
> Subject: [PATCH net] ethtool: fix argument check in do_srxfh function to prevent segmentation fault
Patch makes sense, but two nit picks:
1) please repost with subject:
[PATCH ethtool v2] ethtool: fix argument check in do_srxfh function to prevent segmentation fault
this is a user space CLI patch, not a kernel patch hence ethtool not
net in the brackets.
> 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")
2) Please prevent line wrapping of Fixes tags
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-30 2:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-27 13:39 [PATCH net] ethtool: fix argument check in do_srxfh function to prevent segmentation fault 백광록
2024-07-30 2:04 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).