From 5ceb8b554dcaaf6844415cd2616ce2e0132530fa Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 8 Apr 2015 21:23:51 +0200 Subject: 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 Signed-off-by: Jan Kara --- fs/udf/symlink.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/udf/symlink.c') 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) -- cgit