summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-02-01 03:28:48 +0100
committerTom Rini <trini@konsulko.com>2021-02-24 16:51:48 -0500
commit220fa478fb1a84e51235b92506ff5d48415f0a8e (patch)
treeb234a6019677e43688fbb115403cba2730da4c70 /fs
parentda7991b38e1f6d9b172a72650286be2558dc447f (diff)
downloadu-boot-220fa478fb1a84e51235b92506ff5d48415f0a8e.tar.gz
u-boot-220fa478fb1a84e51235b92506ff5d48415f0a8e.tar.bz2
u-boot-220fa478fb1a84e51235b92506ff5d48415f0a8e.zip
fs/squashfs: NULL dereference in sqfs_closedir()
sqfs_opendir() called in sqfs_size(), sqfs_read(), sqfs_exists() may fail leading to sqfs_closedir(NULL) being called. Do not dereference NULL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/squashfs/sqfs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index dca13bd1f1..29805c3c6f 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -1716,6 +1716,9 @@ void sqfs_closedir(struct fs_dir_stream *dirs)
{
struct squashfs_dir_stream *sqfs_dirs;
+ if (!dirs)
+ return;
+
sqfs_dirs = (struct squashfs_dir_stream *)dirs;
free(sqfs_dirs->inode_table);
free(sqfs_dirs->dir_table);