Re: [PATCH] adjust /dev/{kmem,mem,port} write handlers

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

 



>> @@ -514,11 +510,10 @@ static ssize_t write_kmem(struct file * 
>>  			if (len) {
>>  				written = copy_from_user(kbuf, buf, len);
>>  				if (written) {
>> -					ssize_t ret;
>> -
>> +					if (wrote + virtr)
>> +						break;
>>  					free_page((unsigned long)kbuf);
>> -					ret = wrote + virtr + (len - written);
>> -					return ret ? ret : -EFAULT;
>> +					return -EFAULT;
>>  				}
>>  			}
>>  			len = vwrite(kbuf, (char *)p, len);
>
>
>I think write_kmem() still isn't quie right - it needs to update `p' (and
>hence *ppos) to account for a partial copy_from_user().  (Please double-check)

No, I disagree. The actual write happens with the call to vwrite(), independent of the reading of the user buffer. If
any adjustment might be needed, then it would be to account for the potential of vwrite() (and similarly vread()) to
return 0, resulting in no progress being possible to be made anymore.

Jan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux