linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: bjorn.andersson@linaro.org
Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	Stable <stable@vger.kernel.org>,
	Rishabh Bhatnagar <rishabhb@codeaurora.org>
Subject: Re: [PATCH] firmware: Always initialize the fw_priv list object
Date: Thu, 20 Sep 2018 09:38:56 +0200	[thread overview]
Message-ID: <CAJZ5v0jPiHMsXV5Rz-6K-qH067xYbmzGRY_hdYxS5uU88jMmew@mail.gmail.com> (raw)
In-Reply-To: <20180920010938.10315-1-bjorn.andersson@linaro.org>

On Thu, Sep 20, 2018 at 3:07 AM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> When freeing the fw_priv the item is taken off the list. This causes an
> oops in the FW_OPT_NOCACHE case as the list object is not initialized.
>
> Make sure to initialize the list object regardless of this flag.
>
> Fixes: 422b3db2a503 ("firmware: Fix security issue with request_firmware_into_buf()")
> Cc: stable@vger.kernel.org
> Cc: Rishabh Bhatnagar <rishabhb@codeaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  drivers/base/firmware_loader/main.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
> index b3c0498ee433..8e9213b36e31 100644
> --- a/drivers/base/firmware_loader/main.c
> +++ b/drivers/base/firmware_loader/main.c
> @@ -226,8 +226,11 @@ static int alloc_lookup_fw_priv(const char *fw_name,
>         }
>
>         tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size);
> -       if (tmp && !(opt_flags & FW_OPT_NOCACHE))
> -               list_add(&tmp->list, &fwc->head);
> +       if (tmp) {
> +               INIT_LIST_HEAD(&tmp->list);
> +               if (!(opt_flags & FW_OPT_NOCACHE))
> +                       list_add(&tmp->list, &fwc->head);
> +       }
>         spin_unlock(&fwc->lock);
>
>         *fw_priv = tmp;
> --

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

      parent reply	other threads:[~2018-09-20  7:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20  1:09 [PATCH] firmware: Always initialize the fw_priv list object Bjorn Andersson
2018-09-20  5:22 ` Greg Kroah-Hartman
2018-09-20  7:34   ` Bjorn Andersson
2018-10-01 13:27     ` Niklas Cassel
2018-10-01 18:18       ` Luis Chamberlain
2018-10-01 18:32         ` Bjorn Andersson
2018-10-01 18:53           ` Luis Chamberlain
2018-10-01 20:58           ` Greg Kroah-Hartman
2018-09-20  7:38 ` 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=CAJZ5v0jPiHMsXV5Rz-6K-qH067xYbmzGRY_hdYxS5uU88jMmew@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=rishabhb@codeaurora.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).