From: Heinrich Schuchardt Date: Mon, 1 Feb 2021 02:28:48 +0000 (+0100) Subject: fs/squashfs: NULL dereference in sqfs_closedir() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=220fa478fb1a84e51235b92506ff5d48415f0a8e;p=u-boot.git 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 --- 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);