dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0344-commands-hdparm-Restrict-hdparm-command-when-locked-.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b1bcb2
From: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Date: Wed, 24 Feb 2021 12:59:29 +0100
b1bcb2
Subject: [PATCH] commands/hdparm: Restrict hdparm command when locked down
b1bcb2
b1bcb2
The command can be used to get/set ATA disk parameters. Some of these can
b1bcb2
be dangerous since change the disk behavior. Restrict it when locked down.
b1bcb2
b1bcb2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
b1bcb2
---
b1bcb2
 grub-core/commands/hdparm.c | 6 +++---
b1bcb2
 1 file changed, 3 insertions(+), 3 deletions(-)
b1bcb2
b1bcb2
diff --git a/grub-core/commands/hdparm.c b/grub-core/commands/hdparm.c
b1bcb2
index 3fb08912d82..809b89ea5ab 100644
b1bcb2
--- a/grub-core/commands/hdparm.c
b1bcb2
+++ b/grub-core/commands/hdparm.c
b1bcb2
@@ -434,9 +434,9 @@ static grub_extcmd_t cmd;
b1bcb2
 
b1bcb2
 GRUB_MOD_INIT(hdparm)
b1bcb2
 {
b1bcb2
-  cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, 0,
b1bcb2
-			      N_("[OPTIONS] DISK"),
b1bcb2
-			      N_("Get/set ATA disk parameters."), options);
b1bcb2
+  cmd = grub_register_extcmd_lockdown ("hdparm", grub_cmd_hdparm, 0,
b1bcb2
+				       N_("[OPTIONS] DISK"),
b1bcb2
+				       N_("Get/set ATA disk parameters."), options);
b1bcb2
 }
b1bcb2
 
b1bcb2
 GRUB_MOD_FINI(hdparm)