isofs: Fix unbounded recursion when processing relocated directories
authorJan Kara <jack@suse.cz>
Sun, 17 Aug 2014 09:49:57 +0000 (11:49 +0200)
committerZefan Li <lizefan@huawei.com>
Thu, 25 Sep 2014 03:49:10 +0000 (11:49 +0800)
commit5ccd3e2a9ec54a2e9a9b0a7d9256f2433304fa24
tree8953d59eb22b48a1630a3f9092b13701f607cb46
parentc945ed6b7e5812cfba4d292c3c54fc750bb9f65b
isofs: Fix unbounded recursion when processing relocated directories

commit 410dd3cf4c9b36f27ed4542ee18b1af5e68645a4 upstream.

We did not check relocated directory in any way when processing Rock
Ridge 'CL' tag. Thus a corrupted isofs image can possibly have a CL
entry pointing to another CL entry leading to possibly unbounded
recursion in kernel code and thus stack overflow or deadlocks (if there
is a loop created from CL entries).

Fix the problem by not allowing CL entry to point to a directory entry
with CL entry (such use makes no good sense anyway) and by checking
whether CL entry doesn't point to itself.

Reported-by: Chris Evans <cevans@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Zefan Li <lizefan@huawei.com>
fs/isofs/inode.c
fs/isofs/isofs.h
fs/isofs/rock.c