fs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error
authorRichard Genoud <richard.genoud@posteo.net>
Tue, 3 Nov 2020 11:11:21 +0000 (12:11 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 12 Nov 2021 14:33:59 +0000 (15:33 +0100)
Resetting the context on error will prevent some checks like:
if (!ctx.cur_dev)
To pass when the probe method has failed

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 56cf1ceee38435a0c105d40336d12d19e1db8b1d]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I998b1fa2d790bf9618d0d652663edb220a32c610

fs/squashfs/sqfs.c

index 2e6303917d2c19a141ce9c27a7e06569cc7ae0b4..6fcc5de1f13cc3217cf2643ae18e960bcae5dd80 100644 (file)
@@ -1088,7 +1088,7 @@ int sqfs_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition
 
        ret = sqfs_read_sblk(&sblk);
        if (ret)
-               return ret;
+               goto error;
 
        /* Make sure it has a valid SquashFS magic number*/
        if (get_unaligned_le32(&sblk->s_magic) != SQFS_MAGIC_NUMBER) {