commit | 7af1b41f1f32166259c40a13c0aeebe5c1a8d11c | [log] [tgz] |
---|---|---|
author | Phillip Lougher <[email protected]> | Mon Apr 08 23:02:06 2024 +0100 |
committer | COS Cherry Picker <[email protected]> | Fri Mar 14 17:31:59 2025 -0700 |
tree | 11378d14e0944899dac209839d7ec47dae7ef420 | |
parent | 61a1aa72eee09e975f57eea28e1ad3608d6b2024 [diff] |
Squashfs: check the inode number is not the invalid value of zero commit 9253c54e01b6505d348afbc02abaa4d9f8a01395 upstream. Syskiller has produced an out of bounds access in fill_meta_index(). That out of bounds access is ultimately caused because the inode has an inode number with the invalid value of zero, which was not checked. The reason this causes the out of bounds access is due to following sequence of events: 1. Fill_meta_index() is called to allocate (via empty_meta_index()) and fill a metadata index. It however suffers a data read error and aborts, invalidating the newly returned empty metadata index. It does this by setting the inode number of the index to zero, which means unused (zero is not a valid inode number). 2. When fill_meta_index() is subsequently called again on another read operation, locate_meta_index() returns the previous index because it matches the inode number of 0. Because this index has been returned it is expected to have been filled, and because it hasn't been, an out of bounds access is performed. This patch adds a sanity check which checks that the inode number is not zero when the inode is created and returns -EINVAL if it is. BUG=b/401712064 TEST=presubmit RELEASE_NOTE=Fixed CVE-2024-26982 in the Linux kernel. cos-patch: security-high [[email protected]: whitespace fix] Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Change-Id: I5192eb9ced052343a296bdc30c0b34e3161681a2 Signed-off-by: Phillip Lougher <[email protected]> Reported-by: "Ubisectech Sirius" <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Cc: Christian Brauner <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Xiangyu Chen <[email protected]> Signed-off-by: He Zhe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/95940 Main-Branch-Verified: Cusky Presubmit Bot <[email protected]> Reviewed-by: Shuo Yang <[email protected]> Tested-by: Cusky Presubmit Bot <[email protected]>