aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/exec.c b/fs/exec.c
index ca239fc86d8d..a1789cd684bf 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -866,7 +866,8 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
866 goto out; 866 goto out;
867 } 867 }
868 868
869 *buf = vmalloc(i_size); 869 if (id != READING_FIRMWARE_PREALLOC_BUFFER)
870 *buf = vmalloc(i_size);
870 if (!*buf) { 871 if (!*buf) {
871 ret = -ENOMEM; 872 ret = -ENOMEM;
872 goto out; 873 goto out;
@@ -897,8 +898,10 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
897 898
898out_free: 899out_free:
899 if (ret < 0) { 900 if (ret < 0) {
900 vfree(*buf); 901 if (id != READING_FIRMWARE_PREALLOC_BUFFER) {
901 *buf = NULL; 902 vfree(*buf);
903 *buf = NULL;
904 }
902 } 905 }
903 906
904out: 907out: