Skip to content

Commit 7012040

Browse files
anderssongregkh
authored andcommitted
firmware: Always initialize the fw_priv list object
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: 422b3db ("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> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 492ecf6 commit 7012040

File tree

1 file changed

+5
-2
lines changed
  • drivers/base/firmware_loader

1 file changed

+5
-2
lines changed

drivers/base/firmware_loader/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ static int alloc_lookup_fw_priv(const char *fw_name,
226226
}
227227

228228
tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size);
229-
if (tmp && !(opt_flags & FW_OPT_NOCACHE))
230-
list_add(&tmp->list, &fwc->head);
229+
if (tmp) {
230+
INIT_LIST_HEAD(&tmp->list);
231+
if (!(opt_flags & FW_OPT_NOCACHE))
232+
list_add(&tmp->list, &fwc->head);
233+
}
231234
spin_unlock(&fwc->lock);
232235

233236
*fw_priv = tmp;

0 commit comments

Comments
 (0)