Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1254713

Re: [PATCH 1/2] pstore: check PSTORE_FLAGS_FRAGILE in pstore_unregister

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] pstore: check PSTORE_FLAGS_FRAGILE in pstore_unregister
Date 2015-10-23 19:00 +0200
Message-ID <qmNR8-7hz-25@gated-at.bofh.it> (permalink)
References <qmM8G-508-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Oct 23, 2015 at 7:56 AM, Geliang Tang <geliangtang@163.com> wrote:
> When PSTORE_FLAGS_FRAGILE flag is set, only kmsg is registered in
> pstore_register. So, under these circumstances, only kmsg needs to
> be unregistered in pstore_unregister.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>

Would it make more sense to have the pstore_unregister_* calls be
defensive, like kfree() is? In other words, it would be safe to call
them, even if they hadn't been registered?

Either way, I'm fine with this. Good catch!

-Kees

> ---
>  fs/pstore/platform.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index 0aab920..7ad2038 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -496,9 +496,12 @@ EXPORT_SYMBOL_GPL(pstore_register);
>
>  void pstore_unregister(struct pstore_info *psi)
>  {
> -       pstore_unregister_pmsg();
> -       pstore_unregister_ftrace();
> -       pstore_unregister_console();
> +       if ((psi->flags & PSTORE_FLAGS_FRAGILE) == 0) {
> +               pstore_unregister_pmsg();
> +               pstore_unregister_ftrace();
> +               pstore_unregister_console();
> +       }
> +
>         pstore_unregister_kmsg();
>
>         free_buf_for_compression();
> --
> 2.5.0
>
>



-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] pstore: check PSTORE_FLAGS_FRAGILE in pstore_unregister Geliang Tang <geliangtang@163.com> - 2015-10-23 17:10 +0200
  [PATCH 2/2] efi-pstore: implement efivars_pstore_exit() Geliang Tang <geliangtang@163.com> - 2015-10-23 17:10 +0200
  Re: [PATCH 1/2] pstore: check PSTORE_FLAGS_FRAGILE in pstore_unregister Kees Cook <keescook@chromium.org> - 2015-10-23 19:00 +0200
    Re: [PATCH 1/2] pstore: check PSTORE_FLAGS_FRAGILE in  pstore_unregister Geliang Tang <geliangtang@163.com> - 2015-10-25 03:30 +0100

csiph-web