From e45f3540ae7a6298f27d77d1273375a3d765ca38 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Thu, 2 Aug 2012 09:32:36 +0100 Subject: [PATCH] ext2: add additional check to ext2 loader Check if a pointer is NULL due to specifying an invalid inode group number. Signed-off-by: Frediano Ziglio Signed-off-by: Matt Fleming --- core/fs/ext2/ext2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/fs/ext2/ext2.c b/core/fs/ext2/ext2.c index 716670c..7988faa 100644 --- a/core/fs/ext2/ext2.c +++ b/core/fs/ext2/ext2.c @@ -164,6 +164,9 @@ static struct inode *ext2_iget_by_inr(struct fs_info *fs, uint32_t inr) struct inode *inode; e_inode = ext2_get_inode(fs, inr); + if (!e_inode) + return NULL; + if (!(inode = alloc_inode(fs, inr, sizeof(struct ext2_pvt_inode)))) return NULL; fill_inode(inode, e_inode); -- 2.7.4