Re: [PATCH v10 2/5] fs: split off setxattr_copy and do_setxattr function from setxattr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 29, 2021 at 12:29:59PM -0800, Stefan Roesch wrote:
> +	if (ctx->size) {
> +		if (ctx->size > XATTR_SIZE_MAX)
>  			return -E2BIG;
> -		kvalue = kvmalloc(size, GFP_KERNEL);
> -		if (!kvalue)
> +
> +		ctx->kvalue = kvmalloc(ctx->size, GFP_KERNEL);
> +		if (!ctx->kvalue)
>  			return -ENOMEM;
> -		if (copy_from_user(kvalue, value, size)) {
> -			error = -EFAULT;
> -			goto out;
> +
> +		if (copy_from_user(ctx->kvalue, ctx->value, ctx->size)) {
> +			kvfree(ctx->kvalue);
> +			return -EFAULT;

BTW, what's wrong with using vmemdup_user() here?



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux