diff options
| author | Jiaming Zhang <r772577952@gmail.com> | 2026-08-10 17:24:21 +0800 |
|---|---|---|
| committer | Viacheslav Dubeyko <slava@dubeyko.com> | 2026-08-11 16:37:16 -0700 |
| commit | 627b7865c062ff642c0000f3a4775f1a44b986a4 (patch) | |
| tree | ef95d1700a183edfdb9290bd87dbe56144c2dfab /drivers/media/platform/amd/git@git.tavy.me:linux.git | |
| parent | 00aedd67d75d7b86681bdecaa3b20394e1447d2e (diff) | |
hfsplus: validate extent record length before writing it back
__hfsplus_ext_write_extent() writes the cached extent record back into a
B-tree node using fd->entrylength as the length, and fd->entrylength is
derived in __hfs_brec_find() from two on-disk values:
fd->entrylength = len - keylen;
A crafted image can keep both len and keylen valid but make fd->entrylength
negative (keylen > len). __hfsplus_ext_write_extent() doesn't check
fd->entrylength before consuming it, and hfs_bnode_write() takes the length
as u32, so the negative value turns into a huge one. The copy then reads
data past the end of hip->cached_extents, which is only
sizeof(hfsplus_extent_rec) bytes long, and leaks kernel memory into the
image.
Reject an fd->entrylength that does not match sizeof(hfsplus_extent_rec) in
__hfsplus_ext_write_extent(), mirroring the check already performed in
__hfsplus_ext_read_extent().
Link: https://lore.kernel.org/lkml/cbd7003314c530d4f910eacf019ff80adad6687e.camel@dubeyko.com/
Signed-off-by: Jiaming Zhang <r772577952@gmail.com>
Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
Link: https://lore.kernel.org/r/20260810092422.1691377-1-r772577952@gmail.com
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Diffstat (limited to 'drivers/media/platform/amd/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
