public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Hyunwoo Kim <imv4bel@gmail.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org, imv4bel@gmail.com
Subject: Re: [PATCH] efi/capsule-loader: Fix use-after-free in efi_capsule_write
Date: Wed, 7 Sep 2022 07:54:26 -0700	[thread overview]
Message-ID: <20220907145426.GA127455@ubuntu> (raw)
In-Reply-To: <CAMj1kXHKBkP8JHUSyzEELovvSzUpfO1j2nA+eUbP-smLWjKPog@mail.gmail.com>

On Wed, Sep 07, 2022 at 04:40:08PM +0200, Ard Biesheuvel wrote:
> As far as your fix is concerned: wouldn't it be better to move the
> freeing of the pages to the release hook? Semantically, flush is not
> the right place for this, AFAICT.

you're right. Freeing the buffer in .flush is wrong.
I also think it's appropriate to move the buffer release part to .release.

But looking at the comments,
/**
 * efi_capsule_flush - called by file close or file flush
 * @file: file pointer
 * @id: not used
 *
 *      If a capsule is being partially uploaded then calling this function
 *      will be treated as upload termination and will free those completed
 *      buffer pages and -ECANCELED will be returned.
 **/

efi_capsule_flush() seems to exist for the purpose of canceling uploads in the middle.

If buffer release is moved to .release, will there be any compatibility issues?

  reply	other threads:[~2022-09-07 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 10:32 [PATCH] efi/capsule-loader: Fix use-after-free in efi_capsule_write Hyunwoo Kim
2022-09-07  8:30 ` Ard Biesheuvel
2022-09-07 10:29   ` Hyunwoo Kim
2022-09-07 14:40     ` Ard Biesheuvel
2022-09-07 14:54       ` Hyunwoo Kim [this message]
2022-09-07 15:17         ` Hyunwoo Kim
2022-09-07 15:19           ` Ard Biesheuvel

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=20220907145426.GA127455@ubuntu \
    --to=imv4bel@gmail.com \
    --cc=ardb@kernel.org \
    --cc=linux-efi@vger.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