From 9613bc53b51dd60b85b84b7c75cdfb7d11f2222e Mon Sep 17 00:00:00 2001 From: Todd Kjos Date: Mon, 10 Oct 2022 10:21:23 -0700 Subject: [PATCH] Revert "firmware_loader: use kernel credentials when reading firmware" This reverts commit 5a73581116362340087fad4df7e4530c4a819821. 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 Change-Id: Id8b617b5c91fc080c3b3cbe7ba55cd231bef5cfd --- drivers/base/firmware_loader/main.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c index a4dd500bc141..1372f40d0371 100644 --- a/drivers/base/firmware_loader/main.c +++ b/drivers/base/firmware_loader/main.c @@ -793,8 +793,6 @@ _request_firmware(const struct firmware **firmware_p, const char *name, size_t offset, u32 opt_flags) { struct firmware *fw = NULL; - struct cred *kern_cred = NULL; - const struct cred *old_cred; bool nondirect = false; int ret; @@ -811,18 +809,6 @@ _request_firmware(const struct firmware **firmware_p, const char *name, if (ret <= 0) /* error or already assigned */ 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); /* Only full reads can support decompression, platform, and sysfs. */ @@ -848,9 +834,6 @@ _request_firmware(const struct firmware **firmware_p, const char *name, } else ret = assign_fw(fw, device); - revert_creds(old_cred); - put_cred(kern_cred); - out: if (ret < 0) { fw_abort_batch_reqs(fw);