summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Dinh <[email protected]>2025-06-02 21:50:22 -0700
committerTom Rini <[email protected]>2025-06-25 13:41:35 -0600
commit29cb98d515f96c2330455af4b8cace0220abd00c (patch)
tree9221b73eaf2f278e9b18c5acfd966f60c831c35c
parentb40d7b8f72f181d539b03c807d2dcaf864af552e (diff)
fs: ext4fs: Fix: Data abort in ext4fs_log_gdt()
Return ENOMEM in ext4fs_log_gdt when number of blocks per gdt is more than number of allocated journal entries. Signed-off-by: Tony Dinh <[email protected]>
-rw-r--r--fs/ext4/ext4_journal.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c
index 02c4ac2cb93..868a2c1804a 100644
--- a/fs/ext4/ext4_journal.c
+++ b/fs/ext4/ext4_journal.c
@@ -131,6 +131,13 @@ int ext4fs_log_gdt(char *gd_table)
struct ext_filesystem *fs = get_fs();
short i;
long int var = fs->gdtable_blkno;
+
+ /* Make sure there is enough journal entries */
+ if (fs->no_blk_pergdt > MAX_JOURNAL_ENTRIES) {
+ log_err("*** Not enough journal entries allocated\n");
+ return -ENOMEM;
+ }
+
for (i = 0; i < fs->no_blk_pergdt; i++) {
journal_ptr[gindex]->buf = zalloc(fs->blksz);
if (!journal_ptr[gindex]->buf)