public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: dw: enable using pdata with ACPI
@ 2022-06-19  7:40 Marcin Wojtas
  2022-06-20  7:30 ` Ilpo Järvinen
  2022-06-20  8:00 ` Andy Shevchenko
  0 siblings, 2 replies; 6+ messages in thread
From: Marcin Wojtas @ 2022-06-19  7:40 UTC (permalink / raw)
  To: linux-kernel, linux-serial
  Cc: gregkh, andriy.shevchenko, jirislaby, miquel.raynal, mw, jaz,
	upstream

Commit 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")
caused NULL-pointer dereference when booting with ACPI by unconditional
usage of the recently added pdata.

In order to fix that and prevent similar issues in future, hook the
default version of this structure in dw8250_acpi_match table.

Fixes: 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 drivers/tty/serial/8250/8250_dw.c | 24 ++++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index f57bbd32ef11..3b79bd5c9c9d 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -773,18 +773,18 @@ static const struct of_device_id dw8250_of_match[] = {
 MODULE_DEVICE_TABLE(of, dw8250_of_match);
 
 static const struct acpi_device_id dw8250_acpi_match[] = {
-	{ "INT33C4", 0 },
-	{ "INT33C5", 0 },
-	{ "INT3434", 0 },
-	{ "INT3435", 0 },
-	{ "80860F0A", 0 },
-	{ "8086228A", 0 },
-	{ "APMC0D08", 0},
-	{ "AMD0020", 0 },
-	{ "AMDI0020", 0 },
-	{ "AMDI0022", 0 },
-	{ "BRCM2032", 0 },
-	{ "HISI0031", 0 },
+	{ "INT33C4", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "INT33C5", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "INT3434", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "INT3435", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "80860F0A", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "8086228A", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "APMC0D08", (kernel_ulong_t)&dw8250_dw_apb},
+	{ "AMD0020", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "AMDI0020", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "AMDI0022", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "BRCM2032", (kernel_ulong_t)&dw8250_dw_apb },
+	{ "HISI0031", (kernel_ulong_t)&dw8250_dw_apb },
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
-- 
2.29.0


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

* Re: [PATCH] serial: 8250: dw: enable using pdata with ACPI
  2022-06-19  7:40 [PATCH] serial: 8250: dw: enable using pdata with ACPI Marcin Wojtas
@ 2022-06-20  7:30 ` Ilpo Järvinen
  2022-06-20  9:15   ` Marcin Wojtas
  2022-06-20  8:00 ` Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: Ilpo Järvinen @ 2022-06-20  7:30 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: LKML, linux-serial, Greg Kroah-Hartman, Andy Shevchenko,
	Jiri Slaby, miquel.raynal, jaz, upstream

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

On Sun, 19 Jun 2022, Marcin Wojtas wrote:

> Commit 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")

That commit id is not correct, please fix.

Other than that,
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

> caused NULL-pointer dereference when booting with ACPI by unconditional
> usage of the recently added pdata.
> 
> In order to fix that and prevent similar issues in future, hook the
> default version of this structure in dw8250_acpi_match table.
> 
> Fixes: 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> ---
>  drivers/tty/serial/8250/8250_dw.c | 24 ++++++++++----------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index f57bbd32ef11..3b79bd5c9c9d 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -773,18 +773,18 @@ static const struct of_device_id dw8250_of_match[] = {
>  MODULE_DEVICE_TABLE(of, dw8250_of_match);
>  
>  static const struct acpi_device_id dw8250_acpi_match[] = {
> -	{ "INT33C4", 0 },
> -	{ "INT33C5", 0 },
> -	{ "INT3434", 0 },
> -	{ "INT3435", 0 },
> -	{ "80860F0A", 0 },
> -	{ "8086228A", 0 },
> -	{ "APMC0D08", 0},
> -	{ "AMD0020", 0 },
> -	{ "AMDI0020", 0 },
> -	{ "AMDI0022", 0 },
> -	{ "BRCM2032", 0 },
> -	{ "HISI0031", 0 },
> +	{ "INT33C4", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "INT33C5", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "INT3434", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "INT3435", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "80860F0A", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "8086228A", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "APMC0D08", (kernel_ulong_t)&dw8250_dw_apb},
> +	{ "AMD0020", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "AMDI0020", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "AMDI0022", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "BRCM2032", (kernel_ulong_t)&dw8250_dw_apb },
> +	{ "HISI0031", (kernel_ulong_t)&dw8250_dw_apb },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
> 

-- 
 i.

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

* Re: [PATCH] serial: 8250: dw: enable using pdata with ACPI
  2022-06-19  7:40 [PATCH] serial: 8250: dw: enable using pdata with ACPI Marcin Wojtas
  2022-06-20  7:30 ` Ilpo Järvinen
@ 2022-06-20  8:00 ` Andy Shevchenko
  2022-06-20  9:14   ` Marcin Wojtas
  1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-20  8:00 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: Linux Kernel Mailing List, open list:SERIAL DRIVERS,
	Greg Kroah-Hartman, Andy Shevchenko, Jiri Slaby, Miquel Raynal,
	Grzegorz Jaszczyk, upstream

On Sun, Jun 19, 2022 at 9:43 AM Marcin Wojtas <mw@semihalf.com> wrote:
>
> Commit 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")
> caused NULL-pointer dereference when booting with ACPI by unconditional
> usage of the recently added pdata.
>
> In order to fix that and prevent similar issues in future, hook the
> default version of this structure in dw8250_acpi_match table.

Thanks for the report and fix! One proposal below.

...

>  static const struct acpi_device_id dw8250_acpi_match[] = {
> -       { "INT33C4", 0 },
> -       { "INT33C5", 0 },
> -       { "INT3434", 0 },
> -       { "INT3435", 0 },
> -       { "80860F0A", 0 },
> -       { "8086228A", 0 },
> -       { "APMC0D08", 0},
> -       { "AMD0020", 0 },
> -       { "AMDI0020", 0 },
> -       { "AMDI0022", 0 },
> -       { "BRCM2032", 0 },
> -       { "HISI0031", 0 },
> +       { "INT33C4", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "INT33C5", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "INT3434", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "INT3435", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "80860F0A", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "8086228A", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "APMC0D08", (kernel_ulong_t)&dw8250_dw_apb},
> +       { "AMD0020", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "AMDI0020", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "AMDI0022", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "BRCM2032", (kernel_ulong_t)&dw8250_dw_apb },
> +       { "HISI0031", (kernel_ulong_t)&dw8250_dw_apb },

Since you are touching all of them, please keep the order
alphanumerically sorted by the HID.

>         { },
>  };


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] serial: 8250: dw: enable using pdata with ACPI
  2022-06-20  8:00 ` Andy Shevchenko
@ 2022-06-20  9:14   ` Marcin Wojtas
  2022-06-20  9:17     ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Marcin Wojtas @ 2022-06-20  9:14 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Linux Kernel Mailing List, open list:SERIAL DRIVERS,
	Greg Kroah-Hartman, Andy Shevchenko, Jiri Slaby, Miquel Raynal,
	Grzegorz Jaszczyk, upstream

Hi,

pon., 20 cze 2022 o 10:01 Andy Shevchenko <andy.shevchenko@gmail.com>
napisał(a):
>
> On Sun, Jun 19, 2022 at 9:43 AM Marcin Wojtas <mw@semihalf.com> wrote:
> >
> > Commit 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")
> > caused NULL-pointer dereference when booting with ACPI by unconditional
> > usage of the recently added pdata.
> >
> > In order to fix that and prevent similar issues in future, hook the
> > default version of this structure in dw8250_acpi_match table.
>
> Thanks for the report and fix! One proposal below.
>
> ...
>
> >  static const struct acpi_device_id dw8250_acpi_match[] = {
> > -       { "INT33C4", 0 },
> > -       { "INT33C5", 0 },
> > -       { "INT3434", 0 },
> > -       { "INT3435", 0 },
> > -       { "80860F0A", 0 },
> > -       { "8086228A", 0 },
> > -       { "APMC0D08", 0},
> > -       { "AMD0020", 0 },
> > -       { "AMDI0020", 0 },
> > -       { "AMDI0022", 0 },
> > -       { "BRCM2032", 0 },
> > -       { "HISI0031", 0 },
> > +       { "INT33C4", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "INT33C5", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "INT3434", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "INT3435", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "80860F0A", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "8086228A", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "APMC0D08", (kernel_ulong_t)&dw8250_dw_apb},
> > +       { "AMD0020", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "AMDI0020", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "AMDI0022", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "BRCM2032", (kernel_ulong_t)&dw8250_dw_apb },
> > +       { "HISI0031", (kernel_ulong_t)&dw8250_dw_apb },
>
> Since you are touching all of them, please keep the order
> alphanumerically sorted by the HID.

Sure.

Thanks,
Marcin

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

* Re: [PATCH] serial: 8250: dw: enable using pdata with ACPI
  2022-06-20  7:30 ` Ilpo Järvinen
@ 2022-06-20  9:15   ` Marcin Wojtas
  0 siblings, 0 replies; 6+ messages in thread
From: Marcin Wojtas @ 2022-06-20  9:15 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: LKML, linux-serial, Greg Kroah-Hartman, Andy Shevchenko,
	Jiri Slaby, Miquèl Raynal, Grzegorz Jaszczyk, upstream

Hi,

pon., 20 cze 2022 o 09:31 Ilpo Järvinen
<ilpo.jarvinen@linux.intel.com> napisał(a):
>
> On Sun, 19 Jun 2022, Marcin Wojtas wrote:
>
> > Commit 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")
>
> That commit id is not correct, please fix.
>

Will do, thanks for spotting.

Best regards,
Marcin

> Other than that,
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>
> > caused NULL-pointer dereference when booting with ACPI by unconditional
> > usage of the recently added pdata.
> >
> > In order to fix that and prevent similar issues in future, hook the
> > default version of this structure in dw8250_acpi_match table.
> >
> > Fixes: 3242fe805b52 ("serial: 8250: dw: Move the USR register to pdata")
> > Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> > ---
> >  drivers/tty/serial/8250/8250_dw.c | 24 ++++++++++----------
> >  1 file changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> > index f57bbd32ef11..3b79bd5c9c9d 100644
> > --- a/drivers/tty/serial/8250/8250_dw.c
> > +++ b/drivers/tty/serial/8250/8250_dw.c
> > @@ -773,18 +773,18 @@ static const struct of_device_id dw8250_of_match[] = {
> >  MODULE_DEVICE_TABLE(of, dw8250_of_match);
> >
> >  static const struct acpi_device_id dw8250_acpi_match[] = {
> > -     { "INT33C4", 0 },
> > -     { "INT33C5", 0 },
> > -     { "INT3434", 0 },
> > -     { "INT3435", 0 },
> > -     { "80860F0A", 0 },
> > -     { "8086228A", 0 },
> > -     { "APMC0D08", 0},
> > -     { "AMD0020", 0 },
> > -     { "AMDI0020", 0 },
> > -     { "AMDI0022", 0 },
> > -     { "BRCM2032", 0 },
> > -     { "HISI0031", 0 },
> > +     { "INT33C4", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "INT33C5", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "INT3434", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "INT3435", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "80860F0A", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "8086228A", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "APMC0D08", (kernel_ulong_t)&dw8250_dw_apb},
> > +     { "AMD0020", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "AMDI0020", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "AMDI0022", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "BRCM2032", (kernel_ulong_t)&dw8250_dw_apb },
> > +     { "HISI0031", (kernel_ulong_t)&dw8250_dw_apb },
> >       { },
> >  };
> >  MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
> >
>
> --
>  i.

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

* Re: [PATCH] serial: 8250: dw: enable using pdata with ACPI
  2022-06-20  9:14   ` Marcin Wojtas
@ 2022-06-20  9:17     ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2022-06-20  9:17 UTC (permalink / raw)
  To: Marcin Wojtas
  Cc: Linux Kernel Mailing List, open list:SERIAL DRIVERS,
	Greg Kroah-Hartman, Andy Shevchenko, Jiri Slaby, Miquel Raynal,
	Grzegorz Jaszczyk, upstream

On Mon, Jun 20, 2022 at 11:14 AM Marcin Wojtas <mw@semihalf.com> wrote:
> pon., 20 cze 2022 o 10:01 Andy Shevchenko <andy.shevchenko@gmail.com>
> napisał(a):
> > On Sun, Jun 19, 2022 at 9:43 AM Marcin Wojtas <mw@semihalf.com> wrote:

...

> > Since you are touching all of them, please keep the order
> > alphanumerically sorted by the HID.
>
> Sure.

With that addressed,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>


-- 
With Best Regards,
Andy Shevchenko

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

end of thread, other threads:[~2022-06-20  9:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-19  7:40 [PATCH] serial: 8250: dw: enable using pdata with ACPI Marcin Wojtas
2022-06-20  7:30 ` Ilpo Järvinen
2022-06-20  9:15   ` Marcin Wojtas
2022-06-20  8:00 ` Andy Shevchenko
2022-06-20  9:14   ` Marcin Wojtas
2022-06-20  9:17     ` Andy Shevchenko

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