lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 9 Apr 2015 10:51:05 +0200
From:	Jan Kara <jack@...e.cz>
To:	Fabian Frederick <fabf@...net.be>
Cc:	linux-kernel@...r.kernel.org, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH V2 7/9 linux-next] udf: return error when newIndex is 0
 in udf_translate_to_linux()

On Wed 08-04-15 21:23:57, Fabian Frederick wrote:
> udf_get_filename() and its callsites considered 0 as an error
> without propagating an error value.
> 
> udf_translate_to_linux() now returns -EINVAL when newIndex is 0.
> other functions are updated accordingly.
> 
> Signed-off-by: Fabian Frederick <fabf@...net.be>
  I've updated modified this patch and the changelog to do the check for
zero length filename in udf_get_filename() and not in
udf_translate_to_linux(). Since the second is just a general conversion
function and zero length string as a result is fine with that. But zero
length file name isn't correct and that's why udf_get_filename() should
generate the error. I've also updated the changelog accordingly.

								Honza

> ---
>  fs/udf/dir.c     | 2 +-
>  fs/udf/namei.c   | 2 +-
>  fs/udf/unicode.c | 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/udf/dir.c b/fs/udf/dir.c
> index fcf227e..541d9c6 100644
> --- a/fs/udf/dir.c
> +++ b/fs/udf/dir.c
> @@ -168,7 +168,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
>  		}
>  
>  		flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN);
> -		if (flen <= 0)
> +		if (flen < 0)
>  			continue;
>  
>  		tloc = lelb_to_cpu(cfi.icb.extLocation);
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 59b340c..dd648b7 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -234,7 +234,7 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
>  			continue;
>  
>  		flen = udf_get_filename(sb, nameptr, lfi, fname, UDF_NAME_LEN);
> -		if ((flen > 0) && udf_match(flen, fname, child->len,
> +		if ((flen >= 0) && udf_match(flen, fname, child->len,
>  					    child->name))
>  			goto out_ok;
>  	}
> diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
> index f37123b..3b1efbb 100644
> --- a/fs/udf/unicode.c
> +++ b/fs/udf/unicode.c
> @@ -333,7 +333,7 @@ int udf_get_filename(struct super_block *sb, uint8_t *sname, int slen,
>  		     uint8_t *dname, int dlen)
>  {
>  	struct ustr *filename, *unifilename;
> -	int ret = 0;
> +	int ret;
>  
>  	if (!slen)
>  		return -EIO;
> @@ -492,5 +492,5 @@ static int udf_translate_to_linux(uint8_t *newName, int newLen,
>  		}
>  	}
>  
> -	return newIndex;
> +	return newIndex ? : -EINVAL;
>  }
> -- 
> 1.9.1
> 
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ