[LTP] [PATCH 4/4] can_bcm01: Move vcan to .modprobe

Petr Vorel pvorel@suse.cz
Fri Oct 13 09:47:47 CEST 2023


Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/can/cve/can_bcm01.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/testcases/network/can/cve/can_bcm01.c b/testcases/network/can/cve/can_bcm01.c
index d9a835b03..ec98db133 100644
--- a/testcases/network/can/cve/can_bcm01.c
+++ b/testcases/network/can/cve/can_bcm01.c
@@ -41,14 +41,6 @@ static void setup(void)
 {
 	struct sockaddr_can addr = { .can_family = AF_CAN };
 
-	/*
-	 * Older kernels require explicit modprobe of vcan. Newer kernels
-	 * will load the modules automatically and support CAN in network
-	 * namespace which would eliminate the need for running the test
-	 * with root privileges.
-	 */
-	tst_cmd((const char*[]){"modprobe", "vcan", NULL}, NULL, NULL, 0);
-
 	NETDEV_ADD_DEVICE(LTP_DEVICE, "vcan");
 	NETDEV_SET_STATE(LTP_DEVICE, 1);
 	addr.can_ifindex = NETDEV_INDEX_BY_NAME(LTP_DEVICE);
@@ -143,10 +135,19 @@ static struct tst_test test = {
 	.skip_in_compat = 1,
 	.max_runtime = 30,
 	.needs_drivers = (const char *const[]) {
-		"vcan",
 		"can-bcm",
 		NULL
 	},
+	/*
+	 * Older kernels require explicit modprobe of vcan. Newer kernels
+	 * will load the modules automatically and support CAN in network
+	 * namespace which would eliminate the need for running the test
+	 * with root privileges.
+	 */
+	.modprobe = (const char *const[]) {
+		"vcan",
+		NULL
+	},
 	.tags = (const struct tst_tag[]) {
 		{"linux-git", "d5f9023fa61e"},
 		{"CVE", "2021-3609"},
-- 
2.42.0



More information about the ltp mailing list