acpica-devel.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Huai-Yuan Liu <qq810974084@gmail.com>
Cc: robert.moore@intel.com, rafael.j.wysocki@intel.com,
	lenb@kernel.org,  linux-acpi@vger.kernel.org,
	acpica-devel@lists.linux.dev,  linux-kernel@vger.kernel.org,
	baijiaju1990@outlook.com
Subject: Re: [PATCH] ACPICA: debugger: dbconvert: add a null pointer check
Date: Mon, 8 Apr 2024 16:32:23 +0200	[thread overview]
Message-ID: <CAJZ5v0g087vTJmgLHssedyCuhh61F_hR+TP3HQpoTACuzh+0jA@mail.gmail.com> (raw)
In-Reply-To: <20240403014326.970237-1-qq810974084@gmail.com>

On Wed, Apr 3, 2024 at 3:43 AM Huai-Yuan Liu <qq810974084@gmail.com> wrote:
>
> The memory allocation function ACPI_ALLOCATE_ZEROED does not guarantee a
> successful allocation, but the subsequent code directly dereferences the
> pointer that receives it, which may lead to null pointer dereference.
>
> To fix this issue, a null pointer check should be added. If it is null,
> return exception code AE_NO_MEMORY.
>
> Fixes: 995751025572 ("ACPICA: Linuxize: Export debugger files to Linux")
> Signed-off-by: Huai-Yuan Liu <qq810974084@gmail.com>

Because ACPICA is an external project supplying code to the Linux
kernel, the way to change the ACPICA code in the kernel is to submit a
pull request to the upstream ACPICA project on GitHub and once that PR
has been merged, submit a Linux patch corresponding to it including
the Link: tag pointing to the PR in question and the git ID of the
corresponding upstream ACPICA commit.

However, note that upstream ACPICA changes are applied to the Linux
kernel source code every time the upstream ACPICA project makes a
release, so it is not necessary to send the corresponding Linux
patches for them unless in the cases when timing matters.

> ---
>  drivers/acpi/acpica/dbconvert.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/acpica/dbconvert.c b/drivers/acpi/acpica/dbconvert.c
> index 2b84ac093698..8dbab6932049 100644
> --- a/drivers/acpi/acpica/dbconvert.c
> +++ b/drivers/acpi/acpica/dbconvert.c
> @@ -174,6 +174,8 @@ acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object)
>         elements =
>             ACPI_ALLOCATE_ZEROED(DB_DEFAULT_PKG_ELEMENTS *
>                                  sizeof(union acpi_object));
> +       if (!elements)
> +               return (AE_NO_MEMORY);
>
>         this = string;
>         for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) {
> --
> 2.34.1
>
>

      reply	other threads:[~2024-04-08 14:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  1:43 [PATCH] ACPICA: debugger: dbconvert: add a null pointer check Huai-Yuan Liu
2024-04-08 14:32 ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJZ5v0g087vTJmgLHssedyCuhh61F_hR+TP3HQpoTACuzh+0jA@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=acpica-devel@lists.linux.dev \
    --cc=baijiaju1990@outlook.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qq810974084@gmail.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).