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]
Message-Id: <20150302142531.038da6eafe388aa96a83f1a3@linux-foundation.org>
Date:	Mon, 2 Mar 2015 14:25:31 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Fabian Frederick <fabf@...net.be>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2 linux-next] FS/HFSPLUS: move xattr_name allocation
 in hfsplus_setxattr()

On Fri, 27 Feb 2015 18:38:26 +0100 Fabian Frederick <fabf@...net.be> wrote:

> security/trusted/user/osx setxattr did the same
> xattr_name initialization. Move that operation in hfsplus_setxattr().
> 
> Tested with security/trusted/user getfattr/setfattr 
> 
> --- a/fs/hfsplus/xattr.c
> +++ b/fs/hfsplus/xattr.c
> @@ -424,6 +424,28 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len)
>  	return len;
>  }
>  
> +int hfsplus_setxattr(struct dentry *dentry, const char *name,
> +		     const void *value, size_t size, int flags,
> +		     const char *prefix, size_t prefixlen)
> +{
> +	char *xattr_name;
> +	int res;
> +
> +	if (!strcmp(name, ""))
> +		return -EINVAL;
> +
> +	xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1,
> +		GFP_KERNEL);
> +	if (!xattr_name)
> +		return -ENOMEM;
> +	strcpy(xattr_name, prefix);
> +	strcpy(xattr_name + prefixlen, name);

Can we use kasprintf(GFP_KERNEL, "%s%s", prefix, name) and zap `prefixlen'?

> +	res = __hfsplus_setxattr(dentry->d_inode, xattr_name, value, size,
> +				 flags);
> +	kfree(xattr_name);
> +	return res;
> +}

--
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