Revert "firmware_loader: use kernel credentials when reading firmware"
This reverts commit 5a73581116
.
Introduces incompatible behavior in android12-5.10 which broke
partner devices. Discussion this topic is in b/222166126. The
new behavior should be fine for android13 and later kernels.
The patch was merged into android12-5.10 with the latest LTS
update.
Bug: 247895237
Bug: 248989172
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Id8b617b5c91fc080c3b3cbe7ba55cd231bef5cfd
This commit is contained in:
@@ -793,8 +793,6 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
|
|||||||
size_t offset, u32 opt_flags)
|
size_t offset, u32 opt_flags)
|
||||||
{
|
{
|
||||||
struct firmware *fw = NULL;
|
struct firmware *fw = NULL;
|
||||||
struct cred *kern_cred = NULL;
|
|
||||||
const struct cred *old_cred;
|
|
||||||
bool nondirect = false;
|
bool nondirect = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -811,18 +809,6 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
|
|||||||
if (ret <= 0) /* error or already assigned */
|
if (ret <= 0) /* error or already assigned */
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/*
|
|
||||||
* We are about to try to access the firmware file. Because we may have been
|
|
||||||
* called by a driver when serving an unrelated request from userland, we use
|
|
||||||
* the kernel credentials to read the file.
|
|
||||||
*/
|
|
||||||
kern_cred = prepare_kernel_cred(NULL);
|
|
||||||
if (!kern_cred) {
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
old_cred = override_creds(kern_cred);
|
|
||||||
|
|
||||||
ret = fw_get_filesystem_firmware(device, fw->priv, "", NULL);
|
ret = fw_get_filesystem_firmware(device, fw->priv, "", NULL);
|
||||||
|
|
||||||
/* Only full reads can support decompression, platform, and sysfs. */
|
/* Only full reads can support decompression, platform, and sysfs. */
|
||||||
@@ -848,9 +834,6 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
|
|||||||
} else
|
} else
|
||||||
ret = assign_fw(fw, device);
|
ret = assign_fw(fw, device);
|
||||||
|
|
||||||
revert_creds(old_cred);
|
|
||||||
put_cred(kern_cred);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fw_abort_batch_reqs(fw);
|
fw_abort_batch_reqs(fw);
|
||||||
|
Reference in New Issue
Block a user