summaryrefslogtreecommitdiff
path: root/drivers/base/firmware_loader
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-27 17:19:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-27 17:19:39 +0300
commit4388f887b857de8576a8bf7fefc1202dc7dd10df (patch)
treefc8bb6dbfeba17bdf78e79dcf444e3266ab0e2ef /drivers/base/firmware_loader
parentbd900901b8d1838bf1b6e63063e0025fca42d283 (diff)
downloadlinux-4388f887b857de8576a8bf7fefc1202dc7dd10df.tar.xz
Revert "firmware_loader: use kernel credentials when reading firmware"
This reverts commit 3677563eb8731e1ad5970e3e57f74e5f9d63502a as it leaks memory :( Reported-by: Qian Cai <quic_qiancai@quicinc.com> Link: https://lore.kernel.org/r/20220427135823.GD71@qian Cc: ThiƩbaud Weksteen <tweek@google.com> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: John Stultz <jstultz@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/firmware_loader')
-rw-r--r--drivers/base/firmware_loader/main.c16
1 files changed, 0 insertions, 16 deletions
diff --git a/drivers/base/firmware_loader/main.c b/drivers/base/firmware_loader/main.c
index 9a8579e56c26..921d955b7208 100644
--- a/drivers/base/firmware_loader/main.c
+++ b/drivers/base/firmware_loader/main.c
@@ -798,8 +798,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;
@@ -816,18 +814,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. */
@@ -858,8 +844,6 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
} else
ret = assign_fw(fw, device);
- revert_creds(old_cred);
-
out:
if (ret < 0) {
fw_abort_batch_reqs(fw);