Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

acpiecdt bus tag (was Re: CVS commit: src/sys/dev)



On Fri, Mar 26, 2010 at 07:00:15AM +0200, Jukka Ruohonen wrote:
> On Wed, Mar 24, 2010 at 01:13:30AM +0000, David Young wrote:
> > Module Name:        src
> > Committed By:       dyoung
> > Date:               Wed Mar 24 01:13:30 UTC 2010
> > 
> > Modified Files:
> >     src/sys/dev/acpi: acpi_ec.c
> >     src/sys/dev/isa: pas.c
> > 
> > Log Message:
> > Do not use unitialized bus_space_tag_t's.  Use the tag(s) from the
> > attachment arguments.
> > 
> > 
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.62 -r1.63 src/sys/dev/acpi/acpi_ec.c
> > cvs rdiff -u -r1.67 -r1.68 src/sys/dev/isa/pas.c
> 
> This makes systems with acpiecdt(4) panic early in the boot:
> 
>  static bool acpiec_suspend(device_t, const pmf_qual_t *);
>  static bool acpiec_resume(device_t, const pmf_qual_t *);
> @@ -225,6 +226,7 @@
>  static void
>  acpiecdt_attach(device_t parent, device_t self, void *aux)
>  {   
> +       struct acpi_attach_args *aa = aux;
>         ACPI_HANDLE ec_handle;
>         bus_addr_t cmd_reg, data_reg;
>         uint8_t gpebit;
> @@ -235,8 +237,8 @@
>         aprint_naive("\n");
>         aprint_normal(": ACPI Embedded Controller via ECDT\n");
> 
> -       acpiec_common_attach(parent, self, ec_handle, cmd_reg, data_reg,
> -           NULL, gpebit);
> +       acpiec_common_attach(parent, self, ec_handle, aa->aa_iot, cmd_reg,
> +           aa->aa_iot, data_reg, NULL, gpebit);
>  }
> 
> There is a NULL pointer dereference above, given that the ECDT, unlike rest
> of the APCI device nodes, is attached as:
> 
>         /* Early EC handler initialization if ECDT table is available. */
>         config_found_ia(self, "acpiecdtbus", NULL, NULL);

We should not attach it that way, then! :-)

It is important that acpiec and acpiecdt use bus_space_tag_t's that come
something, such as their parent, instead of tags that are conjured from
the zeroes in their softc.

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933


Home | Main Index | Thread Index | Old Index