isofs: Fix unbounded recursion when processing relocated directories
authorJan Kara <jack@suse.cz>
Sun, 17 Aug 2014 09:49:57 +0000 (11:49 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 13 Sep 2014 22:41:46 +0000 (23:41 +0100)
commitd6621d0d6de4b00498cf1bcd8b78f3caa80edf13
tree94e92bcd050582350c81710de45e8010efcc6d66
parent416b0d26b06bdb49fde51a28ffa7254cc404a9ac
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: Ben Hutchings <ben@decadent.org.uk>
fs/isofs/inode.c
fs/isofs/isofs.h
fs/isofs/rock.c