firmware: Avoid caching firmware when FW_OPT_NOCACHE is set
When calling request_firmware_into_buf(), we pass the FW_OPT_NOCACHE flag with the intent of skipping the caching mechanism of the firmware loader. Unfortunately, that doesn't work, because fw_lookup_and_allocate_buf() isn't told to _not_ add the struct firmware_buf to the firmware cache (fwc) list. So when we call request_firmware_into_buf() the second time, we find the buffer in the cache and return it immediately without reloading. This may break users of request_firmware_into_buf that are expecting a fresh copy of the firmware to be reloaded into memory. The existing copy may either be modified by drivers, remote processors or even freed. Fix fw_lookup_and_allocate_buf to not add to the fwc list if FW_OPT_NOCACHE is set, and also don't do the lookup in the list. Fixes: 0e742e9271 ("firmware: provide infrastructure to make fw caching optional") Change-Id: I39fa4657ab5993b2b8e39ac65000dfc1640db866 Signed-off-by:Vikram Mulukutla <markivx@codeaurora.org> Signed-off-by:
Rishabh Bhatnagar <rishabhb@codeaurora.org>
Loading
Please register or sign in to comment