crash/0080-Fix-for-net-n-option-to-properly-deal-with-an-invali.patch
Lianbo Jiang b6407a85f0 Release: crash-7.3.2-5
Update to the latest upstream commit 47216437e79a ("Fix "net" command on
kernel configured with CONFIG_IPV6=m")

Resolves: rhbz#2166880
Resolves: rhbz#2161133
Resolves: rhbz#2158721
Resolves: rhbz#2156904
Resolves: rhbz#2156898
Resolves: rhbz#2156892
Resolves: rhbz#2156889
Resolves: rhbz#2156885
Resolves: rhbz#2152619

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2023-05-08 17:08:25 +08:00

45 lines
1.2 KiB
Diff

From 0f2e551ef1f9bb10b2fef0c3ac27e9d32488cc47 Mon Sep 17 00:00:00 2001
From: Lianbo Jiang <lijiang@redhat.com>
Date: Wed, 8 Mar 2023 20:22:02 +0800
Subject: [PATCH 80/89] Fix for "net -n" option to properly deal with an
invalid argument
The help/man page of the "net" command suggests that "-n" option can
accept two kinds of argument: PID or task_struct pointer. However,
the "net -n" command accepts an invalid argument and shows the
namespace of the current context silently. For example:
crash> net -n 1000000000
NET_DEVICE NAME IP ADDRESS(ES)
ffff949dc11d7000 lo 127.0.0.1
ffff949dcc01c000 eno49 192.168.122.17
With the patch, emit an error expectedly.
crash> net -n 1000000000
net: invalid task or pid value: 1000000000
Reported-by: Buland Kumar Singh <bsingh@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
net.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net.c b/net.c
index 987dc8934942..18c238be346d 100644
--- a/net.c
+++ b/net.c
@@ -420,6 +420,9 @@ cmd_net(void)
case STR_PID:
case STR_TASK:
task = tc->task;
+ break;
+ case STR_INVALID:
+ error(FATAL, "invalid task or pid value: %s\n", args[optind]);
}
}
break;
--
2.37.1