[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jPiHMsXV5Rz-6K-qH067xYbmzGRY_hdYxS5uU88jMmew@mail.gmail.com>
Date: Thu, 20 Sep 2018 09:38:56 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: bjorn.andersson@...aro.org
Cc: "Luis R. Rodriguez" <mcgrof@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
Stable <stable@...r.kernel.org>,
Rishabh Bhatnagar <rishabhb@...eaurora.org>
Subject: Re: [PATCH] firmware: Always initialize the fw_priv list object
On Thu, Sep 20, 2018 at 3:07 AM Bjorn Andersson
<bjorn.andersson@...aro.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@...r.kernel.org
> Cc: Rishabh Bhatnagar <rishabhb@...eaurora.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@...aro.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@...el.com>
Powered by blists - more mailing lists