On Wed, Feb 16, 2022 at 9:36 PM Kees Cook <keescook(a)chromium.org> wrote:
> On Wed, Feb 16, 2022 at 02:32:40PM -0600, Gustavo A. R. Silva wrote:
> > There is a regular need in the kernel to provide a way to declare
> > having a dynamically sized set of trailing elements in a structure.
> > Kernel code should always use “flexible array members” for these
> > cases. The older style of one-element or zero-length arrays should
> > no longer be used.
> >  https://en.wikipedia.org/wiki/Flexible_array_member
> >  https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length...
> > Link: https://github.com/KSPP/linux/issues/78
> > Signed-off-by: Gustavo A. R. Silva <gustavoars(a)kernel.org>
> Reviewed-by: Kees Cook <keescook(a)chromium.org>
I've created an upstream ACPICA pull request for this change, thanks!
On Tue, Feb 15, 2022 at 8:24 PM Gustavo A. R. Silva
> On Tue, Feb 15, 2022 at 09:19:29PM +0200, Leon Romanovsky wrote:
> > On Tue, Feb 15, 2022 at 01:21:10PM -0600, Gustavo A. R. Silva wrote:
> > > On Tue, Feb 15, 2022 at 10:17:40AM -0800, Kees Cook wrote:
> > > > On Tue, Feb 15, 2022 at 11:47:43AM -0600, Gustavo A. R. Silva wrote:
> > > >
> > > > These all look trivially correct to me. Only two didn't have the end of
> > > > the struct visible in the patch, and checking those showed them to be
> > > > trailing members as well, so:
> > > >
> > > > Reviewed-by: Kees Cook <keescook(a)chromium.org>
> > >
> > > I'll add this to my -next tree.
> > I would like to ask you to send mlx5 patch separately to netdev. We are working
> > to delete that file completely and prefer to avoid from unnecessary merge conflicts.
> Oh OK. Sure thing; I will do so.
Can you also send the ACPI patch separately, please?
We would like to route it through the upstream ACPICA code base.
On Wed, Feb 16, 2022 at 7:26 AM Tong Zhang <ztong0001(a)gmail.com> wrote:
> There are some cases that user use acpi_ns_walk_namespace() without
> checking acpi_disable flag. When acpi=off is provided in boot cmdline,
> acpi_gbl_root_node is NULL and calling acpi_ns_walk_namespace() will
> crash kernel. In order to avoid such misuse, we proactively check null ptr
> and return an error when we know ACPI is disabled.
The issue should be fixed by this commit in the upstream ACPICA code
> Signed-off-by: Tong Zhang <ztong0001(a)gmail.com>
> drivers/acpi/acpica/nswalk.c | 7 +++++++
> 1 file changed, 7 insertions(+)
> diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
> index 915c2433463d..9ae45db16d86 100644
> --- a/drivers/acpi/acpica/nswalk.c
> +++ b/drivers/acpi/acpica/nswalk.c
> @@ -171,6 +171,13 @@ acpi_ns_walk_namespace(acpi_object_type type,
> start_node = acpi_gbl_root_node;
> + /* acpi_gbl_root_node is NULL when acpi=off is provided.
> + * We proactively check nulliness here and return an error if user call
> + * this function without checking acpi_disabled
> + */
> + if (start_node == NULL)
> + return_ACPI_STATUS(AE_ERROR);
> /* Null child means "get first node" */
> parent_node = start_node;