VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Naohiro Aota <naota@elisp.net> 2011-07-12 02:54:13 +0900 committer: Christoph Hellwig <hch@lst.de> 2011-07-22 16:36:56 +0200 commit: aac4e4198eff7f9551d586c55342403d49249d95 parent: dd7f3d5458e5c0eded620fe8192abe7e418fc94c
Commit Summary:
hfsplus: Add additional range check to handle on-disk corruptions
Diffstat:
1 file changed, 4 insertions, 0 deletions
diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c
index 2312de34bd42..2a734cfccc92 100644
--- a/fs/hfsplus/brec.c
+++ b/fs/hfsplus/brec.c
@@ -43,6 +43,10 @@ u16 hfs_brec_keylen(struct hfs_bnode *node, u16 rec)
 			node->tree->node_size - (rec + 1) * 2);
 		if (!recoff)
 			return 0;
+		if (recoff > node->tree->node_size - 2) {
+			printk(KERN_ERR "hfs: recoff %d too large\n", recoff);
+			return 0;
+		}
 
 		retval = hfs_bnode_read_u16(node, recoff) + 2;
 		if (retval > node->tree->max_key_len + 2) {