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 12/29/21 5:15 PM, Al Viro wrote:
> 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?

I was simply following the existing code. The next version will use the vmemdup_user function.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux