Linux EFI development
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 6.2 2/6] efi: efivars: prevent double registration
       [not found] <20230301162929.1302785-1-sashal@kernel.org>
@ 2023-03-01 16:29 ` Sasha Levin
  2023-03-01 16:31   ` Ard Biesheuvel
  2023-03-01 16:29 ` [PATCH AUTOSEL 6.2 4/6] firmware/efi sysfb_efi: Add quirk for Lenovo IdeaPad Duet 3 Sasha Levin
  1 sibling, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2023-03-01 16:29 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Johan Hovold, Ard Biesheuvel, Sasha Levin, linux-efi

From: Johan Hovold <johan+linaro@kernel.org>

[ Upstream commit 0217a40d7ba6e71d7f3422fbe89b436e8ee7ece7 ]

Add the missing sanity check to efivars_register() so that it is no
longer possible to override an already registered set of efivar ops
(without first deregistering them).

This can help debug initialisation ordering issues where drivers have so
far unknowingly been relying on overriding the generic ops.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/firmware/efi/vars.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 0ba9f18312f5b..4ca256bcd6971 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -66,19 +66,28 @@ int efivars_register(struct efivars *efivars,
 		     const struct efivar_operations *ops,
 		     struct kobject *kobject)
 {
+	int rv;
+
 	if (down_interruptible(&efivars_lock))
 		return -EINTR;
 
+	if (__efivars) {
+		pr_warn("efivars already registered\n");
+		rv = -EBUSY;
+		goto out;
+	}
+
 	efivars->ops = ops;
 	efivars->kobject = kobject;
 
 	__efivars = efivars;
 
 	pr_info("Registered efivars operations\n");
-
+	rv = 0;
+out:
 	up(&efivars_lock);
 
-	return 0;
+	return rv;
 }
 EXPORT_SYMBOL_GPL(efivars_register);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH AUTOSEL 6.2 4/6] firmware/efi sysfb_efi: Add quirk for Lenovo IdeaPad Duet 3
       [not found] <20230301162929.1302785-1-sashal@kernel.org>
  2023-03-01 16:29 ` [PATCH AUTOSEL 6.2 2/6] efi: efivars: prevent double registration Sasha Levin
@ 2023-03-01 16:29 ` Sasha Levin
  1 sibling, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2023-03-01 16:29 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Darrell Kavanagh, Hans de Goede, Ard Biesheuvel, Sasha Levin,
	linux-efi

From: Darrell Kavanagh <darrell.kavanagh@gmail.com>

[ Upstream commit e1d447157f232c650e6f32c9fb89ff3d0207c69a ]

Another Lenovo convertable which reports a landscape resolution of
1920x1200 with a pitch of (1920 * 4) bytes, while the actual framebuffer
has a resolution of 1200x1920 with a pitch of (1200 * 4) bytes.

Signed-off-by: Darrell Kavanagh <darrell.kavanagh@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/firmware/efi/sysfb_efi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
index 7882d4b3f2be4..f06fdacc9bc83 100644
--- a/drivers/firmware/efi/sysfb_efi.c
+++ b/drivers/firmware/efi/sysfb_efi.c
@@ -264,6 +264,14 @@ static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
 					"Lenovo ideapad D330-10IGM"),
 		},
 	},
+	{
+		/* Lenovo IdeaPad Duet 3 10IGL5 with 1200x1920 portrait screen */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
+					"IdeaPad Duet 3 10IGL5"),
+		},
+	},
 	{},
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 6.2 2/6] efi: efivars: prevent double registration
  2023-03-01 16:29 ` [PATCH AUTOSEL 6.2 2/6] efi: efivars: prevent double registration Sasha Levin
@ 2023-03-01 16:31   ` Ard Biesheuvel
  2023-03-01 18:59     ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2023-03-01 16:31 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-kernel, stable, Johan Hovold, linux-efi

On Wed, 1 Mar 2023 at 17:29, Sasha Levin <sashal@kernel.org> wrote:
>
> From: Johan Hovold <johan+linaro@kernel.org>
>
> [ Upstream commit 0217a40d7ba6e71d7f3422fbe89b436e8ee7ece7 ]
>
> Add the missing sanity check to efivars_register() so that it is no
> longer possible to override an already registered set of efivar ops
> (without first deregistering them).
>
> This can help debug initialisation ordering issues where drivers have so
> far unknowingly been relying on overriding the generic ops.
>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

NAK this is not a bugfix.

> ---
>  drivers/firmware/efi/vars.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
> index 0ba9f18312f5b..4ca256bcd6971 100644
> --- a/drivers/firmware/efi/vars.c
> +++ b/drivers/firmware/efi/vars.c
> @@ -66,19 +66,28 @@ int efivars_register(struct efivars *efivars,
>                      const struct efivar_operations *ops,
>                      struct kobject *kobject)
>  {
> +       int rv;
> +
>         if (down_interruptible(&efivars_lock))
>                 return -EINTR;
>
> +       if (__efivars) {
> +               pr_warn("efivars already registered\n");
> +               rv = -EBUSY;
> +               goto out;
> +       }
> +
>         efivars->ops = ops;
>         efivars->kobject = kobject;
>
>         __efivars = efivars;
>
>         pr_info("Registered efivars operations\n");
> -
> +       rv = 0;
> +out:
>         up(&efivars_lock);
>
> -       return 0;
> +       return rv;
>  }
>  EXPORT_SYMBOL_GPL(efivars_register);
>
> --
> 2.39.2
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 6.2 2/6] efi: efivars: prevent double registration
  2023-03-01 16:31   ` Ard Biesheuvel
@ 2023-03-01 18:59     ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2023-03-01 18:59 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-kernel, stable, Johan Hovold, linux-efi

On Wed, Mar 01, 2023 at 05:31:15PM +0100, Ard Biesheuvel wrote:
>On Wed, 1 Mar 2023 at 17:29, Sasha Levin <sashal@kernel.org> wrote:
>>
>> From: Johan Hovold <johan+linaro@kernel.org>
>>
>> [ Upstream commit 0217a40d7ba6e71d7f3422fbe89b436e8ee7ece7 ]
>>
>> Add the missing sanity check to efivars_register() so that it is no
>> longer possible to override an already registered set of efivar ops
>> (without first deregistering them).
>>
>> This can help debug initialisation ordering issues where drivers have so
>> far unknowingly been relying on overriding the generic ops.
>>
>> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
>> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
>NAK this is not a bugfix.

Ack, I'll drop it. Thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-01 18:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230301162929.1302785-1-sashal@kernel.org>
2023-03-01 16:29 ` [PATCH AUTOSEL 6.2 2/6] efi: efivars: prevent double registration Sasha Levin
2023-03-01 16:31   ` Ard Biesheuvel
2023-03-01 18:59     ` Sasha Levin
2023-03-01 16:29 ` [PATCH AUTOSEL 6.2 4/6] firmware/efi sysfb_efi: Add quirk for Lenovo IdeaPad Duet 3 Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox