isofs: Fix unbounded recursion when processing relocated directories
authorJan Kara <jack@suse.cz>
Sun, 17 Aug 2014 09:49:57 +0000 (11:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Sep 2014 23:28:34 +0000 (16:28 -0700)
commitd4be3e07222e7572df4af6c4dd91e4b569a3ce20
treee96d18aed105405575a6a88fe734a8f8f0967550
parent0c9fdd4c5af24ea49424903296cb1f7420505e9e
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/isofs/inode.c
fs/isofs/isofs.h
fs/isofs/rock.c