revert "squashfs: harden sanity check in squashfs_read_xattr_id_table"
authorAndrew Morton <akpm@linux-foundation.org>
Fri, 3 Feb 2023 02:07:35 +0000 (18:07 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 4 Feb 2023 01:52:25 +0000 (17:52 -0800)
This fix was nacked by Philip, for reasons identified in the email linked
below.

Link: https://lkml.kernel.org/r/68f15d67-8945-2728-1f17-5b53a80ec52d@squashfs.org.uk
Fixes: 72e544b1b28325 ("squashfs: harden sanity check in squashfs_read_xattr_id_table")
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Fedor Pchelkin <pchelkin@ispras.ru>
Cc: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/squashfs/xattr_id.c

index b88d19e9581e932a799a09c2ef7780c265e9892f..c8469c656e0dcfd3cecffd56f58bd8a1e0ff009d 100644 (file)
@@ -76,7 +76,7 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 table_start,
        /* Sanity check values */
 
        /* there is always at least one xattr id */
-       if (*xattr_ids <= 0)
+       if (*xattr_ids == 0)
                return ERR_PTR(-EINVAL);
 
        len = SQUASHFS_XATTR_BLOCK_BYTES(*xattr_ids);