summaryrefslogtreecommitdiff
path: root/fs/udf/symlink.c
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2015-04-08 22:23:51 +0300
committerJan Kara <jack@suse.cz>2015-05-18 12:23:03 +0300
commit5ceb8b554dcaaf6844415cd2616ce2e0132530fa (patch)
treec80877de890e6f3ab8d47aae705d39401031efb8 /fs/udf/symlink.c
parentc0655fe9b0901a968800f56687be3c62b4cce5d2 (diff)
downloadlinux-5ceb8b554dcaaf6844415cd2616ce2e0132530fa.tar.xz
udf: Return -ENOMEM when allocation fails in udf_get_filename()
Return -ENOMEM when allocation fails in udf_get_filename(). Update udf_pc_to_char(), udf_readdir(), and udf_find_entry() to handle the error appropriately. This allows us to pass appropriate error to userspace instead of corrupting symlink contents by omitting some path elements. Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/symlink.c')
-rw-r--r--fs/udf/symlink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c
index 8dfbc4025e2f..862535b3ba58 100644
--- a/fs/udf/symlink.c
+++ b/fs/udf/symlink.c
@@ -82,6 +82,9 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
comp_len = udf_get_filename(sb, pc->componentIdent,
pc->lengthComponentIdent,
p, tolen);
+ if (comp_len < 0)
+ return comp_len;
+
p += comp_len;
tolen -= comp_len;
if (tolen == 0)