diff mbox series

lib: fwts_efi_module: fix flags on device open

Message ID 20201127185903.28151-1-colin.king@canonical.com
State Accepted
Headers show
Series lib: fwts_efi_module: fix flags on device open | expand

Commit Message

Colin Ian King Nov. 27, 2020, 6:59 p.m. UTC
From: Colin Ian King <colin.king@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@canonical.com>
---
 src/lib/src/fwts_efi_module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ivan Hu Nov. 30, 2020, 6:04 a.m. UTC | #1
On 11/28/20 2:59 AM, Colin King wrote:
> From: Colin Ian King <colin.king@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@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);
>  }
>  
>  /*
> 


Acked-by: Ivan Hu <ivan.hu@canonical.com>
Alex Hung Nov. 30, 2020, 8:42 a.m. UTC | #2
On 2020-11-27 11:59 a.m., Colin King wrote:
> From: Colin Ian King <colin.king@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@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);
>  }
>  
>  /*
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox series

Patch

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);
 }
 
 /*