public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Coiby Xu <coxu@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>,
	kexec@lists.infradead.org,  linux-arm-kernel@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org,
	 Arnaud Lefebvre <arnaud.lefebvre@clever-cloud.com>,
	Baoquan he <bhe@redhat.com>, Dave Young <dyoung@redhat.com>,
	 Kairui Song <ryncsn@gmail.com>,
	Pingfan Liu <kernelfans@gmail.com>,
	 Krzysztof Kozlowski <krzk@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Thomas Staudt <tstaudt@de.ibm.com>,
	Will Deacon <will@kernel.org>,
	 "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	 Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	 Nicholas Piggin <npiggin@gmail.com>,
	Saravana Kannan <saravanak@kernel.org>,
	 open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 3/3] arm64,ppc64le/kdump: pass dm-crypt keys to kdump kernel
Date: Fri, 3 Apr 2026 17:40:52 +0800	[thread overview]
Message-ID: <ac-KKklNrB5eQFvG@Rk> (raw)
In-Reply-To: <20260402233118.08ea88a6836bd10f01031cce@linux-foundation.org>

On Thu, Apr 02, 2026 at 11:31:18PM -0700, Andrew Morton wrote:
>On Thu, 2 Apr 2026 16:24:14 +0530 Sourabh Jain <sourabhjain@linux.ibm.com> wrote:
>
>> But while reading crash_load_dm_crypt_keys() I noticed a possibility of a
>> double free at the address pointed by `keys_header`:
>>
>> In crash_load_dm_crypt_keys()/crash_dump_dm_crypt.c
>>      snip...
>>
>>      kbuf.buffer = keys_header;
>>
>>      snip....
>>
>>      r = kexec_add_buffer(&kbuf);
>>      if (r) {
>>          pr_err("Failed to call kexec_add_buffer, ret=%d\n", r);
>>          kvfree((void *)kbuf.buffer);                           <---
>> First Free
>>          return r;
>>      }
>>
>> Since `keys_header` is not reset, the next call to build_keys_header()
>> will cause a double free at `keys_header`.
>>
>> static int build_keys_header(void)
>> {
>>
>>      snip...
>>
>>      if (keys_header != NULL)
>>          kvfree(keys_header);
>>
>>      snip...
>> }
>>
>> What do you think?
>
>It looks that way to me.

Thanks for confirming it! I'll send a patch after finishing the testing.

-- 
Best regards,
Coiby



  reply	other threads:[~2026-04-03  9:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25  6:03 [PATCH v5 0/3] kdump: Enable LUKS-encrypted dump target support in ARM64 and PowerPC Coiby Xu
2026-02-25  6:03 ` [PATCH v5 1/3] crash_dump/dm-crypt: Don't print in arch-specific code Coiby Xu
2026-03-31  7:12   ` Baoquan He
2026-04-02  1:46     ` Coiby Xu
2026-02-25  6:03 ` [PATCH v5 2/3] crash: Align the declaration of crash_load_dm_crypt_keys with CONFIG_CRASH_DM_CRYPT Coiby Xu
2026-03-31  7:12   ` Baoquan He
2026-02-25  6:03 ` [PATCH v5 3/3] arm64,ppc64le/kdump: pass dm-crypt keys to kdump kernel Coiby Xu
2026-03-30 11:44   ` Rob Herring
2026-04-02  1:44     ` Coiby Xu
2026-04-02 10:54   ` Sourabh Jain
2026-04-03  6:31     ` Andrew Morton
2026-04-03  9:40       ` Coiby Xu [this message]
2026-04-03  9:36     ` Coiby Xu
2026-03-25  4:06 ` [PATCH v5 0/3] kdump: Enable LUKS-encrypted dump target support in ARM64 and PowerPC Andrew Morton

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=ac-KKklNrB5eQFvG@Rk \
    --to=coxu@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnaud.lefebvre@clever-cloud.com \
    --cc=bhe@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=chleroy@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dyoung@redhat.com \
    --cc=kernelfans@gmail.com \
    --cc=kexec@lists.infradead.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=robh@kernel.org \
    --cc=ryncsn@gmail.com \
    --cc=saravanak@kernel.org \
    --cc=sourabhjain@linux.ibm.com \
    --cc=tstaudt@de.ibm.com \
    --cc=will@kernel.org \
    /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