[PATCH] lib: fwts_efi_module: fix flags on device open

Colin King colin.king at canonical.com
Fri Nov 27 18:59:03 UTC 2020


From: Colin Ian King <colin.king at canonical.com>

Currently O_WRONLY | O_RDWR is being incorrectly used to open the efi
test driver.  This works on Linux because O_RDWR is O_RDONLY | O_WRONLY.
Fix the open to correctly use O_RDWR.

Kudos to Heinrich Schuchardt for spotting the issue and reporting
a suitable fix.

Fixes: 9158394f1c86 ("efi: enable module loading to load legacy or new efi driver")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_efi_module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/src/fwts_efi_module.c b/src/lib/src/fwts_efi_module.c
index 0767787b..d47b4f5c 100644
--- a/src/lib/src/fwts_efi_module.c
+++ b/src/lib/src/fwts_efi_module.c
@@ -172,7 +172,7 @@ int fwts_lib_efi_runtime_open(void)
 	if (!efi_dev_name)
 		return -1;
 
-	return open(efi_dev_name, O_WRONLY | O_RDWR);
+	return open(efi_dev_name, O_RDWR);
 }
 
 /*
-- 
2.29.2




More information about the fwts-devel mailing list