]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
get_rock_ridge_filename(): handle malformed NM entries
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 5 May 2016 20:25:35 +0000 (16:25 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 May 2016 00:06:54 +0000 (17:06 -0700)
commit007796c01f0b293c68585397211af2b390bf126d
treea18de4391d4aca47486cb782fbc1638d92612185
parent35eb30c213ab718d1c66d44bcfda524184356250
get_rock_ridge_filename(): handle malformed NM entries

commit 99d825822eade8d827a1817357cbf3f889a552d6 upstream.

Payloads of NM entries are not supposed to contain NUL.  When we run
into such, only the part prior to the first NUL goes into the
concatenation (i.e. the directory entry name being encoded by a bunch
of NM entries).  We do stop when the amount collected so far + the
claimed amount in the current NM entry exceed 254.  So far, so good,
but what we return as the total length is the sum of *claimed*
sizes, not the actual amount collected.  And that can grow pretty
large - not unlimited, since you'd need to put CE entries in
between to be able to get more than the maximum that could be
contained in one isofs directory entry / continuation chunk and
we are stop once we'd encountered 32 CEs, but you can get about 8Kb
easily.  And that's what will be passed to readdir callback as the
name length.  8Kb __copy_to_user() from a buffer allocated by
__get_free_page()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/isofs/rock.c